Details
-
Type:
Bug
-
Status:
Closed
-
Priority:
Major
-
Resolution: Fixed
-
Affects Version/s: None
-
Fix Version/s: 1.2
-
Component/s: Core Runtime
-
Labels:None
-
Environment:Mac OSX 10.5.8 (non-intel), JVM 1.5.0_22, qi4j 1.2-SNAPSHOT (as of 2010-06-21)
Description
Running qi4j.runtime.AppliesToFilterTest (or most other tests) gives the following error:
java.lang.UnsupportedClassVersionError: Bad version number in .class file
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:676)
at org.qi4j.runtime.composite.FragmentClassLoader.findClass(FragmentClassLoader.java:80)
at java.lang.ClassLoader.loadClass(ClassLoader.java:317)
at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
at org.qi4j.runtime.bootstrap.AssemblyHelper.instantiationClass(AssemblyHelper.java:64)
at org.qi4j.runtime.bootstrap.AssemblyHelper.getMixinModel(AssemblyHelper.java:39)
at org.qi4j.runtime.composite.AbstractMixinsModel.implementMethodWithClass(AbstractMixinsModel.java:197)
at org.qi4j.runtime.composite.AbstractMixinsModel.implementMethod(AbstractMixinsModel.java:122)
at org.qi4j.runtime.composite.CompositeMethodsModel.implementMixinType(CompositeMethodsModel.java:134)
at org.qi4j.runtime.composite.CompositeMethodsModel.<init>(CompositeMethodsModel.java:59)
at org.qi4j.runtime.composite.TransientModel.newModel(TransientModel.java:65)
at org.qi4j.runtime.bootstrap.TransientDeclarationImpl.addComposites(TransientDeclarationImpl.java:89)
at org.qi4j.runtime.bootstrap.ModuleAssemblyImpl.assembleModule(ModuleAssemblyImpl.java:263)
at org.qi4j.runtime.bootstrap.ApplicationModelFactoryImpl.newApplicationModel(ApplicationModelFactoryImpl.java:69)
at org.qi4j.bootstrap.Energy4Java.newApplicationModel(Energy4Java.java:70)
at org.qi4j.test.AbstractQi4jTest.newApplication(AbstractQi4jTest.java:100)
at org.qi4j.test.AbstractQi4jTest.setUp(AbstractQi4jTest.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at org.junit.internal.runners.MethodRoadie.runBefores(MethodRoadie.java:122)
at org.junit.internal.runners.MethodRoadie.runBeforesThenTestThenAfters(MethodRoadie.java:86)
at org.junit.internal.runners.MethodRoadie.runTest(MethodRoadie.java:77)
at org.junit.internal.runners.MethodRoadie.run(MethodRoadie.java:42)
at org.junit.internal.runners.JUnit4ClassRunner.invokeTestMethod(JUnit4ClassRunner.java:88)
at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
at com.intellij.rt.junit4.Junit4ClassSuite.run(Junit4ClassSuite.java:99)
at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)
Found this explanation on the internet:
"This usually means that your application has been compiled with a newer
version of JDK than the version you try to run it with. For example,
the source code is compiled with JDK 1.4 but executed with JRE 1.3. JRE 1.3
does not understand the new format of .class files generated by
compiler from JDK 1.4 so you get the error message.
I think this should not happen unless you downgrade your JDK/JRE or
change the Source Level setting in the project's properties."
So it seems that some native
code is compiled in a newer version unrecognized by JVM 1.5.

The classloader was hardcoded to create 1.6 classes. I've changed this to detect running Java version now, and change classformat accordingly.