码迷,mamicode.com
首页 > 编程语言 > 详细

Tomcat 加载 jsp 异常:ServletException: java.lang.LinkageError

时间:2018-10-08 16:36:58      阅读:192      评论:0      收藏:0      [点我收藏+]

标签:real   dos   int   oge   except   org   pat   link   r.java   

环境: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 methods 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

标签:real   dos   int   oge   except   org   pat   link   r.java   

原文地址:https://www.cnblogs.com/xiluhua/p/9755047.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!