users@glassfish.java.net

Absent Code attribute in method that is not native or abstract!

From: <glassfish_at_javadesktop.org>
Date: Mon, 16 Jul 2007 01:27:15 PDT

Here's some fun!

With JRE 1.5.0_11 I get the following error when my JUnit tests are running forked.

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/persistence/LockModeType
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:620)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:56)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
        at org.apache.maven.surefire.booter.IsolatedClassLoader.loadClass(IsolatedClassLoader.java:83)
        at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
        at java.lang.Class.getDeclaredMethods0(Native Method)
        at java.lang.Class.privateGetDeclaredMethods(Class.java:2395)
        at java.lang.Class.privateGetPublicMethods(Class.java:2519)
        at java.lang.Class.getMethods(Class.java:1406)
        at sun.misc.ProxyGenerator.generateClassFile(ProxyGenerator.java:409)
        at sun.misc.ProxyGenerator.generateProxyClass(ProxyGenerator.java:306)
        at java.lang.reflect.Proxy.getProxyClass(Proxy.java:501)
        at java.lang.reflect.Proxy.newProxyInstance(Proxy.java:581)
        at org.easymock.internal.JavaProxyFactory.createProxy(JavaProxyFactory.java:12)
        at org.easymock.internal.MocksControl.createMock(MocksControl.java:36)

If I don't fork my unit tests, no error

If I fork my unit tests and run them with JRE 1.6.*, no error

Here is the code that is causing it to blow up:

    public void setUp() throws Exception {
        IMocksControl mockControl = EasyMock.createControl();
        EntityManager em = mockControl.createMock(EntityManager.class); // throws exception here
    }
[Message sent by forum member 'stephenconnolly' (stephenconnolly)]

http://forums.java.net/jive/thread.jspa?messageID=226722