• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jre compiling error

 
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got an error when I tried to compile the project(jsp,java) in Eclipse.

can anyone shed any light on this? thanks.


This is the error message:

Aug 22, 2006 4:00:38 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: -1 in the jsp file: null

Generated servlet error:
[javac] Compiling 1 source file

C:\Documents and Settings\jbrad\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\work\Catalina\localhost\PTest\jvindex_jsp.java:8: cannot access java.lang.Object
bad class file: C:\Program Files\Java\jre1.5.0_08\lib\rt.jar(java/lang/Object.class)
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public class jvindex_jsp extends HttpJspBase {
^
1 error


at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:120)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:293)
at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:313)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:324)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:474)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:184)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:289)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Unknown Source)
 
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
you got your compiler and runtime versions mixed up.
This question has been asked on every Java forum I know of at least once a week for the last 2 years or so.

Trying to load a 1.5 classfile (in this case the JRE itself) with a 1.4 runtime isn't going to work.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This line:

class file has wrong version 49.0, should be 48.0

suggests that you are mixing different versions of Java - versions 1.4 and 1.5. Make sure that you are running Tomcat on Java 1.5 and that it uses JDK 1.5 to compile the JSP's. Right now, it looks like Tomcat is using JDK 1.4 to compile the JSP's.

Which version of Tomcat are you using? I think the newest versions of Tomcat require Java 1.5 (check the Tomcat documentation), are you trying to run it on Java 1.4?
 
jenny brad
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks for the reply.

I did run on Tomcat 5.5 and jre 1.5.

I can't see what the issue is.
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by jenny brad:
I can't see what the issue is.


You have JDK 1.4 on your system somewhere and for some reason Tomcat is picking that version up to compile your JSP's.

- Uninstall any version 1.4 JDK and JRE from your system.
- Check that JDK 1.4 is not referenced in the PATH environment variable.
 
jenny brad
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I removed the jre 1.4 and jdk 1.4 on my PC. still having the same error.

what else can it be?

Thanks.
 
Jeroen T Wenting
Ranch Hand
Posts: 1847
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
in that case you didn't remove them completely.

Most likely you still have java.exe, javaw.exe, and javaws.exe from the 1.4 in your windows/system32 directory. Remove those.
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Open a command prompt window. Type in the following commands - what is the output? Copy & paste the output here and we can help you further.

java -version

echo %PATH%

echo %JAVA_HOME%
 
jenny brad
Ranch Hand
Posts: 30
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is the output in cmd. Thank you for further help.


C:\Documents and Settings\jj>java -version
java version "1.5.0_08"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_08-b03)
Java HotSpot(TM) Client VM (build 1.5.0_08-b03, mixed mode, sharing)


C:\Documents and Settings\jj>echo %PATH%
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Program Files\Symante
c\pcAnywhere\;C:\Sun\AppServer\bin

C:\Documents and Settings\jj>echo %JAVA_HOME%
%JAVA_HOME%
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hmmm, there's nothing that looks odd there.

Have a look at the Tomcat logfiles. Maybe it's telling you more about what JDK Tomcat is picking up. And carefully examine your system again, because you do have another JDK than Sun JDK 1.5 installed somewhere. Do you have an IBM JDK or Oracle software, or BEA WebLogic or some other piece of software installed that has its own JDK somewhere? Does the Sun appserver stuff have its own JDK?

It's really impossible that you get the class version error if JDK 1.5 is the only JDK that's on your system.

As a last resort, try removing and re-installing JDK 1.5. Although unlikely, maybe something has gotten corrupt in your JDK.
[ August 24, 2006: Message edited by: Jesper Young ]
 
reply
    Bookmark Topic Watch Topic
  • New Topic