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?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

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 ;)
JavatmCommented:
The reason it conflics are for features(methods etc...) of your applocation which are not enabled yet for some versions.
clonmelogAuthor Commented:
Im not actually using  JRE. Just dreamweaver to build the pages.
Become a Certified Penetration Testing Engineer

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

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)
JavatmCommented:
Try using a much lesser version of java :D

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
clonmelogAuthor Commented:
Are you saying that I may need a newer version of tomcat or how exactly can i solve this issue?
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 ;)
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.
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.
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?
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!
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 
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
i think you need to use a newer vesion of Tomcat not a older version.
JavatmCommented:
> i think you need to use a newer vesion of Tomcat not a older version.
Depends on which is more stable ;)
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
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)

Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
please give the full exception.
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
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
i think you have some access permission problem.
JavatmCommented:
Or see if your previous tomcat is still running if not proceed with my comment above.
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?
JavatmCommented:
Could be :) it doesnt hurt to try.
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.
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 ;)
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
why not to try the same thing in administartor mode???
i think it is surely file access permission issue.
Siva Prasanna KumarPrincipal Solutions ArchitectCommented:
javatm we think lot alike.
:-)
clonmelogAuthor Commented:
I dont have admin rights here im afraid.... i would do it at home but i dont have an oracle licence! :-(
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
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
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 :-)
JavatmCommented:
Hahaha glad I was able to help thanks a lot ;)
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
JSP

From novice to tech pro — start learning today.