Link to home
Start Free TrialLog in
Avatar of clonmelog
clonmelog

asked on

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!
Avatar of Javatm
Javatm
Flag of Singapore image

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 ;)
The reason it conflics are for features(methods etc...) of your applocation which are not enabled yet for some versions.
Avatar of clonmelog
clonmelog

ASKER

Im not actually using  JRE. Just dreamweaver to build the pages.
> 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)
ASKER CERTIFIED SOLUTION
Avatar of Javatm
Javatm
Flag of Singapore image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Are you saying that I may need a newer version of tomcat or how exactly can i solve this issue?
> 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 ;)
SOLUTION
Avatar of Siva Prasanna Kumar
Siva Prasanna Kumar
Flag of India image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
> 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.
>>
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?
>>>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!
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 
i think you need to use a newer vesion of Tomcat not a older version.
> i think you need to use a newer vesion of Tomcat not a older version.
Depends on which is more stable ;)
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
also:

root cause

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

please give the full exception.
> 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
i think you have some access permission problem.
Or see if your previous tomcat is still running if not proceed with my comment above.
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?
Could be :) it doesnt hurt to try.
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.
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 ;)
why not to try the same thing in administartor mode???
i think it is surely file access permission issue.
javatm we think lot alike.
:-)
I dont have admin rights here im afraid.... i would do it at home but i dont have an oracle licence! :-(
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
> 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
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 :-)
Hahaha glad I was able to help thanks a lot ;)