JDK1.3.1 and JRE1.4.2

Hi I have a struts based app whose source code is compiled on JDK 1.3.1. It runs perfectly well on JRE1.3.1.I want to upgrade the JRE to something newer ( than what I already have ) like 1.4.2. If I change that, I get following error in the very 1st JSP in the app.

-

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:

D:\firepond\iss\config\tomcat\work\Catalina\l93lm4c1\fsp\org\apache\jsp\index_jsp.java:8: cannot access java.lang.Object

Generated servlet error:

bad class file: jre\lib\rt.jar(java/lang/Object.class)

class file has wrong version 48.0, should be 47.0

Please remove or make sure it appears in the correct subdirectory of the classpath.

-

Why is that ?Because the base product of my app is a third party vendor product, it is not possible to get all the source compiled on 1.4.2.

Is there any other way I can get this to work ?

[958 byte] By [developer@javaa] at [2007-11-27 5:30:04]
# 1
Looks like you are still trying to run tomcat with JDK/JRE 1.3, and not 1.4 (but you have some jars that are compiled with 1.4)Kaj
kajbja at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...
# 2
I have only JRE 1.4.2 on that machine. Also if I replace the 1.4.2 JRE folder in Tomcat with 1.3.1, it starts working .. as soon as I change it back to 1.4.2 I get the same error.
developer@javaa at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...
# 3
Tomcat is running under 1.3 or using a 1.3 compiler which requires bytecode version <= 47, whereas the runtime library of Java 1.4 has bytecode version 48. I'd try using a newer version of Tomcat.
quittea at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...
# 4

I am running this app on Tomcat 5.0 .. How do I find out which compiler tomcat is using ? Is there a way to change it ? like path/classpath/libraries ?

Also If we somehow manage to change that compiler to 1.4.x and it starts compiling JSPs with 1.4.x, wouldn't it conflict with the source class files already compiled with 1.3.1 ? Would this combination work - java files compiled with 1.3.1 and JSPs compiled with 1.4.x ?

developer@javaa at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...
# 5
Might be a configuration issue. See http://tomcat.apache.org/tomcat-5.0-doc/jasper-howto.html#Configuration
quittea at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...
# 6

> I am running this app on Tomcat 5.0 .. How do I find

> out which compiler tomcat is using ? Is there a way

> to change it ? like path/classpath/libraries ?

>

> Also If we somehow manage to change that compiler to

> 1.4.x and it starts compiling JSPs with 1.4.x,

> wouldn't it conflict with the source class files

> already compiled with 1.3.1 ? Would this combination

> work - java files compiled with 1.3.1 and JSPs

> compiled with 1.4.x ?

1.4 can handle older class files.

Kaj

kajbja at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...
# 7
So if I change the web.xml and set compilerSourceVM = 1.4 , will it work ? is there any other parameter that I need to set ? like compilerTargetVM ?
developer@javaa at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...
# 8
Well, you shouldn't set the target VM to 1.5 while running 1.4. The other way is ok, newer VMs should have no problems running older bytecode.
quittea at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...
# 9

I tried adding these parameters to tomcat web xml - under JSP servlet -

<init-param>

<param-name>compilerSourceVM</param-name>

<param-value>1.4</param-value>

</init-param>

<init-param>

<param-name>compilerTargetVM</param-name>

<param-value>1.4</param-value>

</init-param>

<init-param>

But I am still getting the same error. Any thoughts ?

developer@javaa at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...
# 10

Hi All

I found out what the issue was. Tomcat uses "tools.jar" from sun's JRE to compile JSPs at runtime. This tools.jar file needs to be in the classpath and needs to be available at runtime. JRE does not bundle this jar file. I had an older version of tools.jar in classpath, that was causing the issue. I replaced it with the tools.jar from JDK 1.4.2_13 and things started to work.

Thanks for all your help and pointers.

Cheers.

Message was edited by:

developer@java

developer@javaa at 2007-7-12 14:53:47 > top of Java-index,Java Essentials,Java Programming...