dev@glassfish.java.net

Re: WebApplications and Glassfish require same version of JRE

From: Jan Luehe <Jan.Luehe_at_Sun.COM>
Date: Thu, 11 Dec 2008 21:03:58 -0800

On 12/11/08 20:19, Rajeev Kumar wrote:
>
>
> Hi I have two JRE library on my computer :
>
> JRE 1.5
> JRE 1.6
>
> I have compiled my servlet class using library JRE 1.6 and Glassfish
> is using JDK 1.5(JRE 1.5).
> When I am deploying my web application i am getting following error:
>
> HTTP Status 500 -
>
> type Exception report
>
> message
>
> descriptionThe server encountered an internal error () that prevented
> it from fulfilling this request.
>
> exception
>
> javax.servlet.ServletException: PWC1381: Error allocating a servlet
> instance
>
> root cause
>
> java.lang.UnsupportedClassVersionError: PWC1651: Class FileParser has
> unsupported major or minor version numbers, which are greater than
> those found in the Java Runtime Environment version 1.5.0_15
>
> note The full stack traces of the exception and its root causes are
> available in the Sun Java System Application Server 9.1_02 logs.
> Sun Java System Application Server 9.1_02
>
>
>
> And when I compiled my servlet class with JRE 1.5 then everything is
> working.
> Whether it is a bug or a requirement in glassfish which requires
> servlets and and glassfish both must use the same versions of JRE?

The version of the JRE must be equal to or greater than that of a
servlet class file
(or *any* application class file for that matter).
You can't load a class file compiled against JDK 6 in a JRE 5 runtime.
You can, however, load a class file compiled against JDK 5 in a JRE 6
runtime,
because JDK 6 is backwards compatible with JDK 5.

Jan