在Tomcat 7.x上发布了一个war,过一阵子发现localhost:8080都进不去了。在浏览器输入http://localhost:8080出现如下内容:
HTTP Status 500 - java.lang.ClassCastException: org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.el.ELContextImpl
type Exception report
message java.lang.ClassCastException: org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.el.ELContextImpl
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: java.lang.ClassCastException: org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.el.ELContextImpl
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:549)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:470)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)root cause
java.lang.ClassCastException: org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.el.ELContextImpl
org.apache.jasper.runtime.PageContextImpl.proprietaryEvaluate(PageContextImpl.java:1023)
org.apache.jsp.index_jsp._jspService(index_jsp.java:85)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:432)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)note The full stack trace of the root cause is available in the Apache Tomcat/7.0.42 logs.
网友给出的解决方案:
EL表达式的错误
解决方案1:
当项目中引用tomcat目录下面的lib下面的catalina.jar的时候,用myeclipse将项目部署到tomcat下面的时候,会将catalina.jar包加到项目的web-inf下面的lib文件夹下面,这样这个包就会和tomcat下面的lib下面的catalina.jar包冲突会报java.lang.ClassCastException: org.apache.catalina.util.DefaultAnnotationProcessor错误,解决方法是将项目部署到tomcat下面后,将项目的web-inf/lib下面的catalina.jar删掉,然后在重启tomcat,问题解决!
解决方案2:
修改了tomcat里的context.xml文件,在context 元素下添加 <Loader delegate="true" />,即
<Context>
<Loader delegate="true" />
延伸阅读: