Pergunta

I am trying to build and deploy a project to the JBoss deploy folder with the bundeled Maven-Ant script from Eclipse but it always ends up with JBoss logging the following:

nested throwable: (java.lang.UnsupportedClassVersionError: Bad version number in .class file)

The used software for this project is following:

  • Ant 1.6.5
  • Maven-Ant Tasks plugin 2.1.3
  • JBoss 4.0.5 GA
  • JDK 1.4

In Eclipse under Window>Preferences I added the JDK to the Java>Installed JREs list and set it to default too just in case. Under Project>Properties>Java Compiler I have set the compliance level to 1.4 and have also played with the other compliance setting without any success.

Also, JBoss is set to use the exact same JDK which is 1.4_03 from the Oracle website. Odd is that Eclipse tends to identify it as version 1.5. For example on the Java Compiler page it says:

When selectiong 1.4 compliance, make sure to have a compatible JRE installed and activated (currently 1.5).

Can anybody give some advice where could I have gone wrong?

Thanks in advance!

Foi útil?

Solução 4

The JDK I used turned out to be the wrong version. I got in touch with one of the previous developers and he said it definitely should work with JDK 1.5 update 9 and that made all the difference. I got past that ambiguous error message. Sorry for the mess, guys!

Outras dicas

This means that some class inside JBoss was compiled with incompatible (more recent) version of Javac ( has bigger major number ) and your JRE runung JBoss refuses to load this.

( offending class is somewhere on stacktrace )

The only solution is to use more recent JDK to run JBoss and compile ( 1.4 is pretty old and AFAIK no longer supported )

I would start looking in your maven/ant environment properties.

The jdk selection in Eclipse is only used in the ide. The java_home and other options set int your maven properties or ant properties will be used for the compile and build.

I would also check your JAVA_HOME environment variable as if it isn't explicitly set in a properties file it will be acquired from the environment.

You need to make sure the Ant script is also using the correct version; that you get the 1.5 warning is a little troubling--I find it difficult to believe that Eclipse would identify a JDK incorrectly. Also, bear in mind that a JDK is not the same as a JRE, so double-check your paths/etc.

You also need to make sure that all your deployed libraries, and those of JBoss, are compiled with 1.4--if your project has dependencies, it's likely their libraries are not compiled at 1.4.

Also, saying "J2EE JDK 1.4" is a little confusing, because Java EE and Java SE are two different things, and you wouldn't be able to run J2EE 1.4 under JDK 1.4, AFAIK.

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top