Absent Code attribute in method that is not native or abstract

Posted by kerry on Gooder Code See other posts from Gooder Code or by kerry
Published on Thu, 05 Aug 2010 20:44:37 +0000 Indexed on 2010/12/06 16:59 UTC
Read the original article Hit count: 518

Filed under:
|
|

I got the following, quite puzzling error today when running a unit test:

java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/http/Cookie

A google search found this post, which explains that it is caused by having an interface in the classpath, and not an actual implementation.

In this case it’s the java-ee interface. To fix this I added the jetty servlet api implementation to my pom:

    
        jetty
        javax.servlet
        test
    

Piece of cake. I have run in to this before, so I figured I would capture the fix here in case I run in to it again.

© Gooder Code or respective owner

Related posts about Lessons

Related posts about java