wood burning stoves 2.0*
The moose likes JBoss/WildFly and the fly likes Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file" Watch "Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file" New topic
Author

Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file

Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Whenever i try to start JBOSS in DEbug from EClipse IDE , i get this error :

Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.jboss.classloader.spi.base.BaseClassLoader.access$200(BaseClassLoader.java:62)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:504)
at org.jboss.classloader.spi.base.BaseClassLoader$2.run(BaseClassLoader.java:464)
at java.security.AccessController.doPrivileged(Native Method)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:462)
at org.jboss.classloader.spi.base.BaseClassLoader.loadClassLocally(BaseClassLoader.java:439)
at org.jboss.classloader.spi.base.BaseDelegateLoader.loadClass(BaseDelegateLoader.java:134)
at org.jboss.classloader.spi.filter.FilteredDelegateLoader.loadClass(FilteredDelegateLoader.java:131)
at org.jboss.classloader.spi.base.ClassLoadingTask$ThreadTask.run(ClassLoadingTask.java:452)
at org.jboss.classloader.spi.base.ClassLoaderManager.nextTask(ClassLoaderManager.java:254)
at org.jboss.classloader.spi.base.ClassLoaderManager.process(ClassLoaderManager.java:148)
... 33 more
13:26:49,093 ERROR [ProfileServiceBootstrap] Failed to load profile: Summary of incomplete deployments (SEE PREVIOUS ERRORS FOR DETAILS):

Please tell me how o resolve this error ??



Save India From Corruption - Anna Hazare.
Paul Sturrock
Bartender

Joined: Apr 14, 2004
Posts: 10336

You are running JBoss with the wrong version of the JDK.


JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you Paul for the response ,

You are running JBoss with the wrong version of the JDK.


So , how can we solve this error ?? Should i change JDK version or JBOSS version ?? , this will take a lot of time .
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9947
    
161

Ravi Kiran Va wrote:
So , how can we solve this error ?? Should i change JDK version or JBOSS version ?? , this will take a lot of time .


Changing the version of Java used by JBoss is just a matter of few seconds. Set JAVA_HOME to point to the correct JDK version installation.

[My Blog] [JavaRanch Journal]
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you , this is what i am looking for .

One more question , i went to inside JBOSS bin directory and tried to edit the run.bat file :

But i am not sure where to modify the file , that means where to add JAVA_Home ,could you please help me .

if not "%JAVA_HOME%" == "" goto ADD_TOOLS

set JAVA=java

echo JAVA_HOME is not set. Unexpected results may occur.
echo Set JAVA_HOME to the directory of your local JDK to avoid this message.
goto SKIP_TOOLS

:ADD_TOOLS

set JAVA=%JAVA_HOME%\bin\java

if exist "%JAVA_HOME%\lib\tools.jar" goto SKIP_TOOLS
echo Could not locate %JAVA_HOME%\lib\tools.jar. Unexpected results may occur.
echo Make sure that JAVA_HOME points to a JDK and not a JRE.
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 9947
    
161

You shouldn't be setting the JAVA_HOME in that run.bat script. Doing so is going to make it difficult to move that JBoss installation to a different system. Set the JAVA_HOME as an environment variable from the command prompt or your windows environment settings.
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thank you very much , one more clarification .

Is setting JAVA_HOME inside environment varaibles is sufficient ??

OR

DO i need to chnage the Java Compiler Settings under Ecllipse IDE for this ??
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

I change the JAVA_HOME settings under Environment variables but nothing working (same error),please tell me , do i need to change the JDK version used by the Server domain ??

Thanks .
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5812
    
    7

Based on the text of the error message I suspect that you compiled your code using JDK 6 and then are trying to run it with JDK 5.

So when you set JAVA_HOME what did you set it to? (I assume you set JAVA_HOME on the machine running JBoss AS?)

On the machine running Eclipse, which JDK are you using? To find out, open a command prompt and enter "java -version". (Also check the eclipse.ini file, it's in the Eclipse installation directory, to see if you have a "-vm" entry. If so, look at the line after "-vm" - that is the JDK you are using.)

do i need to change the JDK version used by the Server domain ??

I don't understand this question.


JBoss In Action
Ravi Kiran Va
Ranch Hand

Joined: Apr 18, 2009
Posts: 2234

Thanks a lot for all the information , now i got some idea as why i am geetting this error


this is my eclipse.ini file

-showsplash
com.genuitec.myeclipse.product
--launcher.XXMaxPermSize
256m
-vmargs
-Xms128m
-Xmx512m
-Duser.language=en
-XX:PermSize=128M
-XX:MaxPermSize=256M


i didn't find the entry you mentioned , any issues on this .
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Caused by: java.lang.UnsupportedClassVersionError: Bad version number in .class file
 
Similar Threads
Unable to deploy .war file.
Problem starting Jboss AS 5.0
Trouble getting off the ground with JBoss 5.1
How to display data from DAO to jsp in Struts ?
Error while deploying jbossweb-tomcat50.sar in JBoss 5