Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [m2e-users] JUnit runs well using "Run As > Maven test" but fails at "Run As > JUnit test"

javaee-api-6.0.jar contains classes with empty methods and is only useful for compiling. 

You should use one of the javaee6 implementations provided by jboss ( ) or glassfish (not sure what artifactId they use) to actually run things, like tests.

I don't understand why the tests run under maven though, it'd be interesting to provide a sample project to reproduce the bug.


Fred Bricon

On Tue, Jul 24, 2012 at 12:23 PM, Markus Karg <karg@xxxxxxxxx> wrote:

I have a strange classpath problem in m2e and hope you can help.


At the command line (CMD.EXE) on my Windows 7 (64 Bit) machine I can type “mvn test”, which compiles and tests and then says all is good.


Also, I can run “Run As > Maven test”, which prints in the “Console” view that the test passed and all is good.


But within Eclipse when doing “Run As > JUnit Test”, it flips the bar to red after some tests and then says:


java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/ejb/EJBException

                at java.lang.ClassLoader.defineClass1(Native Method)

                at java.lang.ClassLoader.defineClassCond(

                at java.lang.ClassLoader.defineClass(





                at Method)


                at java.lang.ClassLoader.loadClass(

                at sun.misc.Launcher$AppClassLoader.loadClass(

                at java.lang.ClassLoader.loadClass(

                at de.quipsy.entities.ProjectAPQPCompliance.canBeEdited(

                at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                at sun.reflect.NativeMethodAccessorImpl.invoke(

                at sun.reflect.DelegatingMethodAccessorImpl.invoke(

                at java.lang.reflect.Method.invoke(

                at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(


                at org.junit.runners.model.FrameworkMethod.invokeExplosively(

                at org.junit.internal.runners.statements.InvokeMethod.evaluate(

                at org.junit.runners.ParentRunner.runLeaf(

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(

                at org.junit.runners.BlockJUnit4ClassRunner.runChild(

                at org.junit.runners.ParentRunner$

                at org.junit.runners.ParentRunner$1.schedule(

                at org.junit.runners.ParentRunner.runChildren(

                at org.junit.runners.ParentRunner.access$000(

                at org.junit.runners.ParentRunner$2.evaluate(




                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(

                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(


                at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(


Why is this working at CLI but not in GUI? And what the heck is “Absent Code attribute” (I only know “ClassNotFoundException”)?


I tried to fix it using “Maven > Update Project…”, but this did not help. Strange but true, the code compiles very well in Eclipse, including all uses of javax.ejb.EJBException in the java source, and the tree node “Maven Dependencies” actually shows “javaee-api-6.0.jar” containing “javax/ejb/EJBException” in Eclipse’s “Package Explorer” view!


I’m really confused…!




m2e-users mailing list

"Have you tried turning it off and on again" - The IT Crowd

Back to the top