Pages

Wednesday, June 3, 2015

java.lang.ClassFormatError: 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

I was running a Java Web Project in Netbeans 7.1. Earlier the project worked well, I was able to deploy and run the web application in Tomcat 7.0.22 from Netbeans 7.1

Suddenly, My project was not running. When tried to run in Netbeans, I got the following error.

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

On Searching many forums, Everybody suggested to include javaee-api.6.0.jar file in compile time. But none were straight forward to do it in Netbeans.

Just tried to add the following jar files in Processor

javaee-api-6.0.jar 
javaee-web-api-6.0.jar

How to add these Jar Files ?

  1. Open Web Application Project in Netbeans
  2. Right Click over Project , Select Properties
  3. In Project Properties Window, Click Libraries at LHS
  4. Click on Processor Tab
  5. Click Add JAR/Folder button, and add those two Jar file(s) and click Ok




Now You shall try running the Web Application from Netbeans.

Solution Reference:
  1. http://sys-exit.blogspot.in/2013/03/javalangclassformaterror-absent-code.html
  2. http://www.mkyong.com/hibernate/java-lang-classformaterror-absent-code-attribute-in-method-that-is-not-native-or-abstract-in-class-file/
  3. http://www.andrejkoelewijn.com/blog/2010/03/04/absent-code-attribute-in-method-that-is-not-native-or-abstract/
  4. http://forum.spring.io/forum/spring-projects/container/48831-classformaterror-absent-code-attribute

No comments:

Post a Comment