I am planning to use Java servlets in my application. I included the following in my project's POM.xml file to load Java servlet 3.0 implementation jar.
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.servlet</artifactId>
<version>3.2-b05</version>
</dependency>
The project compiles fine. However, when I run it, I get the following error:
java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/ServletException
I searched for it here and found some good answers.
I figured out from them that this error happens when we include the JAR which contains only interfaces defined by servlet API and not the actual implementation. So, I checked that the glassfish jar I am using is just interfaces or it contains implementation too. I found that it is an implementation and not just interfaces.
So now, I am wondering why I am getting this error at runtime. Anyone?
UPDATE:
Just now, I found out that it was a blatant error from my side (I was adding the jar to one project, while, was running an altogether different project!). I am sorry for this. Adding the glassfish servlet implementation DOES solve the issue.
Thanks, Sandeep