Search code examples
javajbossclassloaderjava-6

UnsupportedClassVersionError that occurs only in JBoss 5.1


My application contains 3rd party jar (com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar) that is compiled in Java6. I managed to use it on Tomcat 5.5 that runs Java5 but when I tried to deploy the same application on JBoss 5.1 - I get the error:

[org.jboss.detailed.classloader.ClassLoaderManager] (main) Unexpected error during load of:testdata.SomeAnnotation java.lang.UnsupportedClassVersionError: Bad version number in .class file

that I realized that happens not only to me. as described here.

my questions:
1) why is it possible to use this jar in web-servers such as tomcat but it still bothers Jboss 5.1 ?
2) Why does Jboss class loader load the application's implementaiotn of Jweaver to be used for loading it framework and it doesn't use Jboss aspectJ implementation. Perhaps I should configure its class loading to be parent-first and it will solve this problem?


Solution

  • Java is backwardly compatible, (a Java 5.0 jar can run on Java 6) but not forwardly compatible (A Java 6 jar cannot be used on Java 5.0)

    You need to get a copy of the 3rd party Jar which is compiled for Java 5.0 or upgrade the version of Java to version 6 or later.