[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 ( http://search.maven.org/#artifactdetails%7Corg.jboss.spec%7Cjboss-javaee_6.0_spec%7C1.0.0.Beta3%7CpomÂ) 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.

Regards,

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(ClassLoader.java:631)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.lang.ClassLoader.defineClass(ClassLoader.java:615)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.net.URLClassLoader.access$000(URLClassLoader.java:58)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.net.URLClassLoader$1.run(URLClassLoader.java:197)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.security.AccessController.doPrivileged(Native Method)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.net.URLClassLoader.findClass(URLClassLoader.java:190)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at de.quipsy.entities.ProjectAPQPCompliance.canBeEdited(ProjectAPQPCompliance.java:68)

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

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at java.lang.reflect.Method.invoke(Method.java:597)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:45)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:15)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:42)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:20)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:263)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:68)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:47)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.ParentRunner$3.run(ParentRunner.java:231)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:60)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:229)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.ParentRunner.access$000(ParentRunner.java:50)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:222)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.junit.runners.ParentRunner.run(ParentRunner.java:300)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)

ÂÂÂÂÂÂÂÂÂÂÂÂÂÂÂ at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)

Â

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â!

Â

Thanks!

Markus


_______________________________________________
m2e-users mailing list
m2e-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/m2e-users




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