您的位置:首页 > 移动开发

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

2013-02-11 19:41 549 查看
The method getJspApplicationContext(ServletContext) is undefined for the type JspFactory的解决方法:

访问项目的时候突然报了如下错误:

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

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

An error occurred at line: 23 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:334)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:312)

org.apache.jasper.compiler.Compiler.compile(Compiler.java:299)

org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:589)

org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)

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)

note The full stack trace of the root cause is available in the Apache Tomcat/6.0.24 logs.

Apache Tomcat/6.0.24

后来在网上查了查,说是因为项目中有像jsp-api.jar servlet-api.jar跟tomcat6的lib中同样的包,但版本比tomcat6的版本要低,在运行的时候,因为会优先加载项目中的包,所以产生了错误,把项目中和tomcat相同的包删除(必须删除,如果替换还会产生其他的错误),问题就可以解决了。

实际通过这个问题,则可以明白,在布署jsp网站(在tomcat上)的时候,项目中的jar包不能有和tomcat的lib中相同的包(自己包的版本比 tomcat低或相同),否则会因为先加载自己项目中的包而导致程序错误。所以在有相包的情况的时候,将自己的包给删掉,就不会出现问题了。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐