Friday, 26 March 2010

The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

I got this error after redeploying a web app to tomcat6 in myeclipse 8.

org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 22 in the generated java file
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory

Stacktrace:
at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:423)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:317)

The reason was that
javax.servlet.jsp.jar
javax.servlet.jar

had been copied to

...\webapps\myapp\WEB-INF\lib

And the versions conflicted with the tomcat versions

Deleting
javax.servlet.jsp.jar
javax.servlet.jar
from
...\webapps\myapp\WEB-INF\lib

fixed the problem

1 comment:

Anbir Priyan.... said...

Thanks for your post. It is really helpful. Had two versions of javax.servlet was causing the trouble.

It is resolved now.