2013-09-25 182 views
1

我正在使用Spring並嘗試使用tomcat 7啓動應用程序,但我一直收到此錯誤,對春季的Linkeage錯誤很有幫助。SEVERE:servlet jsp的Servlet.service()拋出異常java.lang.LinkageError:加載器約束違例

以下是完整的錯誤:

Sep 24, 2013 7:54:15 PM org.apache.catalina.core.ApplicationDispatcher invoke 
SEVERE: Servlet.service() for servlet jsp threw exception 
java.lang.LinkageError: loader constraint violation: when resolving interface method "javax.servlet.jsp.JspApplicationContext.getExpressionFactory()Ljavax/el/ExpressionFactory;" the class loader (instance of org/apache/jasper/servlet/JasperLoader) of the current class, org/apache/jsp/WEB_002dINF/views/home_jsp, and the class loader (instance of org/apache/catalina/loader/StandardClassLoader) for resolved class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type avax/el/ExpressionFactory; used in the signature 
    at org.apache.jsp.WEB_002dINF.views.home_jsp._jspInit(home_jsp.java:23) 
    at org.apache.jasper.runtime.HttpJspBase.init(HttpJspBase.java:49) 
    at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:171) 
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:356) 
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:391) 
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:684) 
    at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:471) 
    at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:402) 
    at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:329) 
    at org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:238) 
    at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:262) 
    at org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1180) 
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:950) 
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852) 
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882) 
    at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:621) 
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:722) 
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304) 
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210) 
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240) 
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164) 
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462) 
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164) 
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100) 
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:562) 
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118) 
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:395) 
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:250) 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:188) 
    at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:166) 
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:302) 
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) 
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) 
    at java.lang.Thread.run(Thread.java:724) 
+2

對我來說,就像你在你的類路徑中有兩個'jsp-api.jar'一樣。你在使用maven嗎?如果是這樣,請發佈您的pom.xml。否則,發佈你在'WEB-INF/lib'中的內容。 –

回答

1

我所遇到的部署在Tomcat 6.0

我在發行版中發現應用時指出,EL-API JAR文件已經被同樣的錯誤默認。 Tomcat正試圖加載兩個不喜歡的JAR。

刪除WEB-INF/lib文件夾中的el-api JAR,然後重試。

0

嘗試Spring roo應用程序時出現同樣的錯誤。 由於user1724646,這個問題是由在pom.xml

<!--<dependency> 
     <groupId>javax.el</groupId> 
     <artifactId>el-api</artifactId> 
     <version>2.2</version> 
     <scope>provided</scope> 
</dependency> --> 
0

此問題是由正在加載的el-api兩個版本引起註釋掉EL-api.jar中解決。默認情況下,Tomcat 7 Common類加載器加載el-api 2.2有關這方面的更多信息可以在http://tomcat.apache.org/tomcat-7.0-doc/class-loader-howto.html上找到。該加載器加載的罐子位於$CATALINA_HOME/lib。解決方案是從您的Web應用程序中刪除el-api jar(即WEB-INF/lib)。

相關問題