Tomcat 加载 jsp 异常:ServletException: java.lang.LinkageError
Posted xiluhua
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Tomcat 加载 jsp 异常:ServletException: java.lang.LinkageError相关的知识,希望对你有一定的参考价值。
环境:win10
JDK:java version "1.8.0_131"
mvn 内置 Tomcat 报错:
javax.servlet.ServletException: 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/success_jsp, and the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm)
for the method‘s defining class, javax/servlet/jsp/JspApplicationContext, have different Class objects for the type javax/el/ExpressionFactory used in the signature org.apache.jasper.servlet.JspServlet.service(JspServlet.java:343) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:209) org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:266) org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:1225) org.springframework.web.servlet.DispatcherServlet.processDispatchResult(DispatcherServlet.java:1012) org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:959) org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:876) org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:931) org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:822) javax.servlet.http.HttpServlet.service(HttpServlet.java:621) org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:807) javax.servlet.http.HttpServlet.service(HttpServlet.java:728) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51) org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108) org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:88) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:108)
原因:
Tomcat 包下的 javax.el-api 与 用于验证的 Hibernate-validation 包下的 javax.el-api 冲突。
解决:
<dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-validator</artifactId> <version>5.0.0.CR2</version> <exclusions> <exclusion> <groupId>javax.el</groupId> <artifactId>javax.el-api</artifactId> </exclusion> </exclusions> </dependency>
以上是关于Tomcat 加载 jsp 异常:ServletException: java.lang.LinkageError的主要内容,如果未能解决你的问题,请参考以下文章
如何修改类文件和jsp页面后不用重启tomcat就可以自动加载呢
at org.apache.jsp.index_jsp._jspInit(index_jsp.java:23)异常解决
JSP Tomcat8.0运行连接池时发生异常AbstractMethodError oracle.jdbc.driver.T4CConnection.isValid(I)Z