• 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>
  • 相关阅读:
    [Android Studio] Android Studio底边栏选项不见了,如何调出来
    [Android Studio] Android Studio中查看类的继承关系
    [Android Studio] Android Studio如何提示函数用法
    [Android Studio] Android Studio如何查看branch列表及切换branch(转载)
    [Android Studio] Android Studio使用教程(二)
    [Android Studio] Android Studio使用教程(一)
    [Android Studio] Android Studio移除的Module如何恢复(转载)
    [Android Studio] Android Studio如何删除module(转载)
    [Linux] ubuntu下查看CHM的软件
    python 在Windows中描述路径时出现的问题
  • 原文地址:https://www.cnblogs.com/xiluhua/p/9755047.html
Copyright © 2020-2023  润新知