Wednesday, September 10, 2014

Absent Code Attribute In Method That Is Not Native Or Abstract In Class File

Java.Lang.ClassFormatError : Absent Code Attribute In Method That Is Not Native Or Abstract In Class File 


This error came up when I was doing the JPA Hibernate development.

Problem is coming because of javaee.jar
I have something like below in pom.xml in my maven dependency.

<dependencies> <dependency> <groupId>javax</groupId> <artifactId>javaee-api</artifactId> <version>6.0</version> </dependency> </dependencies>

Solution is don't use it like this. Above setting will download the jar but it's size is 3KB. Which has nothing but pointers to the java ee apis.

So I downloaded the JEE6 from oracle. Problem is there is nothing called as JEE 6. It's a specification. Oracle download gives Glassfish 3 server , which is reference implementation of the JEE6 specification. So you will not get the javaee.jar that you want. Glassfish has the 3KB jar as you would get by above maven dependency.

Real solution is to download it manually . 
Java ee jar is here for JEE 6 : http://download.java.net/maven/2/javax/javaee-api/6.0/javaee-api-6.0.jar

No comments: