Andrej Koelewijn

  • Home
  • About
  • Publications
  • Departments
    • agile
    • architecture
    • cloud
    • java
    • mobile
    • open standards
    • oracle
    • oss
    • other
    • soa
    • software development
    • tablet
    • Uncategorized
    • web
  • Subscribe via RSS

Absent Code attribute in method that is not native or abstract

March 4th, 2010  |  Published in java, oss, soa  |  6 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.

  • http://www.herasaf.org/ Wolfgang

    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.

  • http://www.andrejkoelewijn.com/ andrej

    Ok, thanks.

  • Pingback: Absent Code attribute in method that is not native or abstract « Gooder Code - web development blog, php, java, asp.net, html, javascript

  • jjmontes

    I think that using ‘provided’ is correct in order to compile. At runtime, implementation would be provided by your JEE container.

    If you need to run outside the container (i.e. for unit tests or as a standalone client), then you would need to add another dependency that includes the implementation (the JAX-RS implementation libraries).

    Just my two cents.

  • Singhrohans

    what you can do is download a javaee jar from oracle and then built your own library and can add it.it will completly solve the error

  • rat

    dont remove the dependency. Just put the scope on test temporary

Tags

activemq agile bi camel css esb google governance grails groovy gtalk html5 internet ipad ivy J2EE java javascript jaxrs jmx jquery lean linkeddata linux maven mule noiv openoffice opensource Open Source oracle osgi oss rdbms rest scrum servicemix soa sql svg tablet web 2.0 XML xmpp yql

Archives

  • February 2012
  • January 2012
  • December 2011
  • November 2011
  • October 2011
  • September 2011
  • August 2011
  • July 2011
  • June 2011
  • May 2011
  • April 2011
  • March 2011
  • February 2011
  • January 2011
  • December 2010
  • November 2010
  • October 2010
  • September 2010
  • August 2010
  • June 2010
  • March 2010
  • February 2010
  • January 2010
  • December 2009
  • November 2009
  • October 2009
  • August 2009
  • July 2009
  • June 2009
  • May 2009
  • April 2009
  • March 2009
  • February 2009
  • January 2009
  • December 2008
  • November 2008
  • October 2008
  • January 2008
  • December 2007
  • November 2007
  • October 2007
  • September 2007
  • August 2007
  • July 2007
  • June 2007
  • May 2007
  • April 2007
  • March 2007
  • February 2007
  • January 2007
  • December 2006
  • November 2006
  • October 2006
  • August 2006
  • July 2006
  • June 2006
  • May 2006
  • April 2006
  • March 2006
  • January 2006
  • December 2005
  • November 2005
  • October 2005
  • September 2005
  • August 2005
  • July 2005
  • June 2005

Meta

  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org

Recent Posts

  • Self-service architecture to avoid water-scrum-fall
  • Updating a vagrant box
  • Using littleproxy in Mule unit tests
  • Useful site to determine what html5, css3 & svg you can use
  • A Product Owner is a Project Manager

Categories

  • agile
  • architecture
  • cloud
  • java
  • mobile
  • open standards
  • oracle
  • oss
  • other
  • soa
  • software development
  • tablet
  • Uncategorized
  • web

Recent Comments

  • From DevOps to NoOps to NoCollabs :: Andrej Koelewijn on LAC2011 presentation: Scrum under Architecture
  • andrej on Software architecture, PHP and Javascript
  • Pcdiggs on Software architecture, PHP and Javascript
  • Een Scrum Product Owner is een Project Leider on A Product Owner is a Project Manager
  • Using css webfonts in inkscape :: Andrej Koelewijn on Create presentations using inkscape
Buzz
andrkoel: Utrecht hele dag mist, scheveningen zomerse dag... http://t.co/cDRCJHr9
4:35 PM Nov 10, 2011, comment
andrkoel: RT @stefanvdkamp: Beter filmpje van Garret McNamara in de 30 meter hoge golf. http://t.co/9abiWkYX
9:20 AM Nov 10, 2011, comment
andrkoel: Mmm, een uur voor den haag - leiden lijkt te weinig, ga mijn afspraak niet redden...
7:34 AM Nov 10, 2011, comment
andrkoel: Big Data is Useless without Science http://t.co/2I8EiLsH
6:18 AM Nov 10, 2011, comment
andrkoel: Just tried #vagrant to quickly setup virtualbox development environment. Looks good, although provisioning apache through puppet failed...
10:47 PM Nov 09, 2011, comment
 


©2012 Andrej Koelewijn
Powered by WordPress using the Gridline Lite theme by Graph Paper Press.