公司原来web项目是在tomcat 下运行 包括tomcat运行环境在内所有的jar都放到目录WEB-INF/lib下,一切正常,切换到jetty(9.3)以后启动报错
java.lang.NoClassDefFoundError: Could not initialize class org.apache.jasper.el.ELContextImpl
查了一下 原来是因为 serlet容器jar冲突导致
以下摘自http://stackoverflow.com 一篇 提问,说得很好,
That can happen if your webapp ships with servletcontainer-specific JAR files such as jasper.jar
, jetty.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.
解决办法,删除项目目录下 有关 jasper servlet的jar 依赖容器本身的jar运行,避免冲突。原文解释中有一句话 “ It doesn't belong there.”,我觉得 这句话很关键,提醒我们该谁管的就该谁去管,别瞎往一起整,呵呵。
感叹一下做这个web项目框架整合的哥们。