org.apache.jasper.el.ELContextImpl cannot be cast to org.apache.jasper.runtime.ELContextImpl

时间:2021-08-11 21:30:41

这个问题纠结了好久,好几个项目都报出相同的错误,以至于想象到Tomcat的问题,卸载重装~~然并卵

------网上大致有两种解决办法,类似于这样:

解决案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删掉重启tomcatok

解决案2:
修改tomcatcontext.xml文件context 元素添加
<Context>
<Loader delegate="true" />
 
  然而对我都不好用
后面在*上看到了这段话:

That can happen if your webapp ships with servletcontainer-specific JAR files such as jasper.jarjetty.jar servlet.jar, etc in the /WEB-INF/lib for some unclear reason. This is in turn conflicting with with a different versioned JAR file on the target servletcontainer.

Remove that servletcontainer-specific JAR file from your webapp's /WEB-INF/lib. It doesn't belong there. It's supposed to be already supplied by the servletcontainer itself.

起因是jetty和相关tomcat的jar包冲突:

解决办法:把pom中的有关jetty的jar注释掉即可

<!--   <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-server</artifactId> <version>8.1.8.v20121106</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-webapp</artifactId> <version>8.1.8.v20121106</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-servlet</artifactId> <version>8.1.8.v20121106</version> </dependency> <dependency> <groupId>org.eclipse.jetty</groupId> <artifactId>jetty-jsp</artifactId> <version>8.1.8.v20121106</version> </dependency> -->
这样,从新部署,成功~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~