Absent Code attribute in method that is not native or abstract
March 4th, 2010 | Published in java, oss, soa | 3 Comments
I ran into the following problem yesterday while building a rest service using resteasy: the code would compile ok, but the unit tests wouldn’t run. I got the following exception in the output of the unit tests:
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/ws/rs/ext/RuntimeDelegate at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(ClassLoader.java:621) at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
The problem is caused by the javeee-api dependency in my maven pom. As described here, the following dependency provides you with the java-ee api’s, not the implementation. This is ok for compiling, but can’t be used for executing code.
<dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> </dependency>
I thought i’d solved the issue by adding a scope of provided or even compile, but this doesn’t fix the problem. The maven build still fails with the Absent code attribute… error. Removing the dependency completely solves the issue for now, but will probably give me some problems when i add more code which uses jee6.
March 15th, 2010 at 11:09 am (#)
Hi,
just in case you're still wondering. I had the same problem with jsf2.0 libraries and found a version 2.0.2 in jboss repo. And with this the problem disappeared. I recommend you simply check for other versions of the javaee-api libraries. Seems that Oracle is already impacting the quality of the Glassfish products. Good Luck.
March 17th, 2010 at 11:24 am (#)
Ok, thanks.
August 5th, 2010 at 9:44 pm (#)
[...] google search found this post, which explains that it is caused by having an interface in the classpath, and not an actual [...]