Skip to main content

UnsupportedClassVersionError

9 replies [Last post]
oosie
Offline
Joined: 2005-05-26
Points: 0

Hello,

When I run ant -f setup.xml I get the following:

...
create.domain.unix:
[exec] Exception in thread "main" java.lang.UnsupportedClassVersionError: com/sun/enterprise/cli/framework/CLIMain (Unsupported major.minor version 49.0)
[exec] at java.lang.ClassLoader.defineClass0(Native Method)
[exec] at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
[exec] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
[exec] at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
[exec] at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
[exec] at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
[exec] at java.security.AccessController.doPrivileged(Native Method)
[exec] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[exec] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[exec] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

BUILD FAILED

I tried J2SDK 1.4.2_08, JDK 1.5.0_03 and JDK 1.5.0_04

Can anybody help me with this?

Regards,
Jack...

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
vbkraemer
Offline
Joined: 2003-09-03
Points: 0
bitmaster
Offline
Joined: 2003-06-16
Points: 0

Can you describe a bit more what you mean by "tried", especially as it relates to the JDK 1.5.0 installs?

Also, some information about your environment would be tremendously helpful.

http://catb.org/~esr/faqs/smart-questions.html#beprecise

-- /v\atthew

oosie
Offline
Joined: 2005-05-26
Points: 0

Ok, I'll do my best to be more precise.

According to the documentation I have to execute the following in the root folder of GlassFish:

ant -f setup.xml

When I execute this, I get the mentioned exception:

create.domain.unix:
[exec] Exception in thread "main" java.lang.UnsupportedClassVersionError: com/sun/enterprise/cli/framework/CLIMain (Unsupported major.minor version 49.0)
[exec] at java.lang.ClassLoader.defineClass0(Native Method)
[exec] at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
[exec] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
[exec] at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
[exec] at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
[exec] at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
[exec] at java.security.AccessController.doPrivileged(Native Method)
[exec] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[exec] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[exec] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

BUILD FAILED

I meant by "tried", that I used different versions of the JDK when executing the mentioned command. That is, I set the JAVA_HOME property to each of the following:

- J2SDK 1.4.2_08
- JDK 1.5.0_03
- JDK 1.5.0_04

All with the same resulting exception. I tried these various versions as the exception indicates an unsupported class version (UnsupportedClassVersionError).

I am running Red Hat's Fedora Core 4. I also downloaded and installed Sun Java System Application Server Platform Edition 8.1 2005Q2 UR2, but I don't think this is being used. At this point I don't think my hardware specification matters, but please tell me if I'm wrong about that.

If I failed to supply enough information, please let me know.

Regards,
Jack...

dochez
Offline
Joined: 2003-06-10
Points: 0

Hi Jack

Looks like you are running with jdk1.4.2. This is strange if you are setting the JAVA_HOME to jdk 1.5

One thing you should try is

ant --execdebug -f setup.xml

this should show you which java is used to invoke ant.

Jerome

oosie
Offline
Joined: 2005-05-26
Points: 0

Sorry for my late follow-up on this, but I got pulled of this for awhile. But now I'm back at it again...

I tried your suggestion Jerome and this is what I get:

exec "/usr/java/jdk1.5.0_04/bin/java" -classpath "/usr/local/ant/1.6.x/1.6.5/lib/ant-launcher.jar" -Dant.home="/usr/local/ant/1.6.x/1.6.5" -Dant.library.dir="/usr/local/ant/1.6.x/1.6.5/lib" org.apache.tools.ant.launch.Launcher -cp "" "-f" "setup.xml"

It looks like it's using jdk1.5.0_04 and not jdk1.4.2_08. Following is the complete output:
[root@localhost GlassFish]# ant --execdebug -f setup.xml
exec "/usr/java/jdk1.5.0_04/bin/java" -classpath "/usr/local/ant/1.6.x/1.6.5/lib/ant-launcher.jar" -Dant.home="/usr/local/ant/1.6.x/1.6.5" -Dant.library.dir="/usr/local/ant/1.6.x/1.6.5/lib" org.apache.tools.ant.launch.Launcher -cp "" "-f" "setup.xml"
Buildfile: setup.xml

all:

get.java.home:

setup.init:

do.copy.windows:

do.copy.unix:

do.copy:

get.java.home:

setup.init:

do.token.windows:

do.token.unix:

do.token:

get.java.home:

setup.init:

do.chmod.unix:
[chmod] Result: 255

do.chmod.linux:
[echo] Changing permissions on Linux

do.chmod:

get.java.home:

setup.init:

create.domain.windows:

create.domain.unix:
[echo] ::install.home:/opt/GlassFish
[exec] Exception in thread "main" java.lang.UnsupportedClassVersionError: com/sun/enterprise/cli/framework/CLIMain (Unsupported major.minor version 49.0)
[exec] at java.lang.ClassLoader.defineClass0(Native Method)
[exec] at java.lang.ClassLoader.defineClass(ClassLoader.java:539)
[exec] at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
[exec] at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
[exec] at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
[exec] at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
[exec] at java.security.AccessController.doPrivileged(Native Method)
[exec] at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
[exec] at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:274)
[exec] at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
[exec] at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)

BUILD FAILED
/opt/GlassFish/setup.xml:75: The following error occurred while executing this line:
/opt/GlassFish/setup.xml:279: exec returned: 1

Total time: 4 seconds

Regards,
Jack...

dochez
Offline
Joined: 2003-06-10
Points: 0

ok you definitely use the right JDK when invoking ant, however the asadmin command to create the domain must still be using the jdk 1.4.2. One thing to look at now is the /config/asenv.conf

I would not be surprised if AS_JAVA points to 1.4.2
For reference, this variable allow you to select which jdk to run with glassfish.

Let me know.

Jerome

oosie
Offline
Joined: 2005-05-26
Points: 0

You were absolutely rihgt! It works now! Thank you very much for you help!

aamonten
Offline
Joined: 2004-03-09
Points: 0

I had the same problem when I run maven configure-runtime .. the fix is the same, but I'm nearly sure that the file is at $glassfish_home/config and not $glassfish_root/config folder.. can any corroborate this?

vijaysr
Offline
Joined: 2003-06-11
Points: 0

Yes - asenv.conf will be present @ glassfish.home/config