URGENT:org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.

Hi,

Im currently trying to create a login in jsp and im getting the following errors:

org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.
error: Invalid class file format in C:\Program Files\Java\jdk1.5.0_06\jre\lib\rt.jar(java/lang/Object.class).  The major.minor version '49.0' is too recent for this tool to understand.

G:\tomcat4\work\Standalone\localhost\_\home$jsp.java:0: Class java.lang.Object not found in class javax.servlet.GenericServlet.
package org.apache.jsp;
^
2 errors, 1 warning

Im not sure if this is a problem with my setup or what it is.

the code being used here is:

<%@ page import="java.sql.*" %>

<html>
<head>
<title>Admin Verification</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>

<%

    Connection connection = null;
    try {
        // Load the JDBC driver
        String driverName = "oracle.jdbc.driver.OracleDriver";
        Class.forName(driverName);
   
        // Create a connection to the database
        String serverName = "witnt07.wit.ie";
        String portNumber = "1521";
        String sid = "orawit";

        String url = "jdbc:oracle:thin:@" + serverName + ":" + portNumber + ":" + sid;
        String username = "W01445693";
        String password = "EPEDXZ";
        connection = DriverManager.getConnection(url, username, password);
    } catch (ClassNotFoundException e) {
        out.println( "Could not find the database driver");
    } catch (SQLException e) {
      e.printStackTrace();
        out.println( "Could not connect to the database");
    }
      
%>

<%

session.setAttribute("Username",request.getParameter("Username"));

try
{
    String user = request.getParameter("Username");
    String formPassword = request.getParameter("Password");
      String Password = null;

 
    Statement stmt = connection.createStatement();
    ResultSet rs = stmt.executeQuery("select Pass from Supervisor WHERE Username = '" + user + "'");


      if( formPassword == null) {
            String redirectURL = "/momentum/error.jsp";
        response.sendRedirect(redirectURL);
      }
      else {
            if( rs.next() )
            {
                  Password = rs.getString("Password");
                                          
                  if( formPassword.equals( Password ) )
                  {
                        //login sucess
                        
            String redirectURL = "/momentum/adminoptions.jsp";
        response.sendRedirect(redirectURL);


                  
                  }
                  else
                  {
                        //login failed
                        
            String redirectURL = "/momentum/error.jsp";
        response.sendRedirect(redirectURL);
      
                  }
                  
            }
            else
            {
                  //Login failed
            String redirectURL = "/momentum/error1.jsp";
        response.sendRedirect(redirectURL);
            }
      }
 }
 
finally
{
    connection.close();
}

%>
 
</body>
</html>

any ideas?

thanks!
LVL 2
clonmelogAsked:
Who is Participating?
 
JavatmCommented:
Try using a much lesser version of java :D
0
 
JavatmCommented:
If your using an IDE, specifically eclipse check the JRE you are using sometimes it does conflicts on JRE's right click the project and then properties select the java compiler to change settings or any equivalent you may also want to rebuild ;)
0
 
JavatmCommented:
The reason it conflics are for features(methods etc...) of your applocation which are not enabled yet for some versions.
0
Cloud Class® Course: Microsoft Office 2010

This course will introduce you to the interfaces and features of Microsoft Office 2010 Word, Excel, PowerPoint, Outlook, and Access. You will learn about the features that are shared between all products in the Office suite, as well as the new features that are product specific.

 
clonmelogAuthor Commented:
Im not actually using  JRE. Just dreamweaver to build the pages.
0
 
JavatmCommented:
> Im not actually using  JRE. Just dreamweaver to build the pages.
it may not be JRE's it can be the main compiler 2 > C:\Program Files\Java\jdk1.5.0_06\jre\lib\rt.jar(java/lang/Object.class)
0
 
clonmelogAuthor Commented:
Are you saying that I may need a newer version of tomcat or how exactly can i solve this issue?
0
 
JavatmCommented:
> The major.minor version '49.0' is too recent for this tool to understand.
It might be that some of what you are using are already depricated ;)
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
i think there are some files missing in your classpath and also with such a latest JRE why are you using such a old version of Tomcat, try out Tomcat 5.5.

Also just try adding the required jars to class path it may solve your problem.
0
 
JavatmCommented:
> Are you saying that I may need a newer version of tomcat or how exactly can i solve this issue?

You can try 1st if 1.4.2 of java the rebuild your project if it doesnt help then use a lesser version of tomcat which is compatible w/ your jre ;)
It happend to me once when I use eclipse.
0
 
clonmelogAuthor Commented:
>>
Try using a much lesser version of java :D

I dont actually have admin rights to the machine that i am working on. Is there any solution for this other than working with an older verison of Java?
0
 
clonmelogAuthor Commented:
>>>You can try 1st if 1.4.2 of java the rebuild your project if it doesnt help then use a lesser version of tomcat which is compatible w/ your jre ;)
It happend to me once when I use eclipse.

Ill try this now!
0
 
JavatmCommented:
If I'm not mistaken (tomcat version == java version) to work well, see the JDK 1.4 Compatability Package:
http://tomcat.apache.org/download-55.cgi 
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
i think you need to use a newer vesion of Tomcat not a older version.
0
 
JavatmCommented:
> i think you need to use a newer vesion of Tomcat not a older version.
Depends on which is more stable ;)
0
 
clonmelogAuthor Commented:
Ok ive upgraded to a newer version of tomcat as you suggested above and now im getting the error:

org.apache.jasper.JasperException: Unable to compile class for JSP
0
 
clonmelogAuthor Commented:
also:

root cause

java.io.FileNotFoundException: G:\apache-tomcat-5.5.16\work\Catalina\localhost\_\org\apache\jsp\adminresult1_jsp.java (Access is denied)

0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
please give the full exception.
0
 
JavatmCommented:
> Ok ive upgraded to a newer version of tomcat
Remember that tomcat also varies with version of your java compiler so if you downloaded 5.5.16 try java 1.4
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
i think you have some access permission problem.
0
 
JavatmCommented:
Or see if your previous tomcat is still running if not proceed with my comment above.
0
 
clonmelogAuthor Commented:
ive seen other posts on EE with similar errors refering to a classes.zip file? i dont think i have this in my setuo. could it be related to the problem and if so what do i do with this file?
0
 
JavatmCommented:
Could be :) it doesnt hurt to try.
0
 
clonmelogAuthor Commented:
OK ive tried to add that file and no luck. Ive also attempted to get rid of the pronblem with an upgrade of my tomcat version but im getting another error, i think it may be something to do with permissions.

when i start tomcat there are a few errors though which may be contributing to the upgrade from working, see this screenshot: http://www.templateit.net/javascreen.JPG

Is there a way to change paths or something to get rid of the above errors. I think this may be the reason that the files are failing to compile.
0
 
JavatmCommented:
Are you not the admininstrator ? if so better uninstall tomcat on add/remove and then use the zip file it works even w/o admin ;)
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
why not to try the same thing in administartor mode???
i think it is surely file access permission issue.
0
 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
javatm we think lot alike.
:-)
0
 
clonmelogAuthor Commented:
I dont have admin rights here im afraid.... i would do it at home but i dont have an oracle licence! :-(
0
 
JavatmCommented:
and for a good start I would suggest use netbeans IDE its a combination of all a web-editor, integrated tomcat, and many more just try it cause its what I'm using
I'm pretty sure w/ all this mess it's a 98% cure :

Download : http://www.netbeans.info/downloads/download.php?type=5.0
Features : http://www.netbeans.org/products/ide/features.html
Tutorials : http://www.netbeans.org/kb/50/quickstart-webapps.html
0
 
JavatmCommented:
> I dont have admin rights here im afraid....

Use the zip for tomcat or better use this IDE as what my suggestion suggest :)
http://us1.mirror.netbeans.org/download/5_0/fcs/200601251500/netbeans-5_0.zip
0
 
clonmelogAuthor Commented:
i think youve pretty much solved that problem so ill close the question.

ive changed machines to a pc running java 1.4 and with tomcat version 4 so that conflic will be gone. I still get errors in my script though so ill be opening another question v soon :-)
0
 
JavatmCommented:
Hahaha glad I was able to help thanks a lot ;)
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.