关于org.apache.jasper.JasperException: Unable to compile class for JSP问题的解决

好久没有写Jsp程序,今天部署了用Tomcat部署了一个Jsp的网站,使用Tomcat 6.0的环境,部署成功后,出现以下错误:

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:
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330)
org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:439)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
org.apache.struts2.dispatcher.FilterDispatcher.doFilter(FilterDispatcher.java:413)

由于我的Jsp页面是一个空页面,所有不会有22行之类的东西,判断是jar包出现问题

找到一个文章http://saber5d.blog.163.com/blog/static/1279987782010119113746918/,尝试着解决了一下,果然可以。

解决办法就是把有像jsp-api.jar servlet-api.jar跟tomcat6的lib中同样的包都给去掉,重新部署,重新启动就可以了。

你可能感兴趣的:(关于org.apache.jasper.JasperException: Unable to compile class for JSP问题的解决)