Can't instantiate javax.servlet.ServletException
Posted
by Denis
on Stack Overflow
See other posts from Stack Overflow
or by Denis
Published on 2010-06-05T10:27:28Z
Indexed on
2010/06/05
10:32 UTC
Read the original article
Hit count: 275
Hello, experts!
I am trying to create instance of class javax.servlet.ServletException with following code
public class MyTroubleViewer {
public static void main(String[] args) {
javax.servlet.ServletException servletException = new javax.servlet.ServletException("Hello");
System.out.println(servletException.getMessage());
}
}
But I get exception on creating:
Exception in thread "main" java.lang.ClassFormatError: Absent Code attribute in method that is not native or abstract in class file javax/servlet/ServletException
...
Maven helps me with dependecies:
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>6.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
What am I doing wrong?
© Stack Overflow or respective owner