views:

254

answers:

1

I have been trying to get tomcat 6.0 to work on my local machine and have been unsuccessful. The server starts up normally, but when I try to view a page I get an exception:

SEVERE: Servlet.service() for servlet jsp threw exception
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:439)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)
    .......

public void _jspInit() {
    _el_expressionfactory = _jspxFactory.getJspApplicationContext(getServletConfig().getServletContext()).getExpressionFactory();
    _jsp_annotationprocessor = (org.apache.AnnotationProcessor) getServletConfig().getServletContext().getAttribute(org.apache.AnnotationProcessor.class.getName());
}
+2  A: 

Check that the libraries in your web application do not contain anything which Tomcat provides. Specifically, look out for JSP and JSP-EL libraries.

This problem reminds me of when Ivy was automatically importing the Spring JSP libraries and the servlet libraries which Tomcat really didn't like.

Sarge
I noticed that the servlet-api and jsp-api are added. Do you think this could be the problem? I have them as scope=provided in maven, but they are also in the tomcat/lib directory.
partkyle
Remove them. Use a different scope in maven. From memory, if you are using spring 3 then use compile scope.
Sarge
I changed their scope, and everything works fine on the command line maven. I run into the same problems when I try to use the m2eclipse plugin though
partkyle
Is m2eclipse requesting the scope you want? Is it reading the right files?
Sarge