报错信息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/index_jsp,
and the class loader (instance of org/codehaus/plexus/classworlds/realm/ClassRealm) for resolved class, javax/servlet/jsp/JspApplicationContext,
have different Class objects for the type avax/el/ExpressionFactory; used in the signature解读:
have different Class objects for the type avax/el/ExpressionFactory; used in the signature, 这句话说的是,classLoader在加载ExpressionFactory这个接口的实现的时候发现有多个实现类,所以报错了。既然是这样那就来maven的依赖关系中来找一找关于el的类,
解决:hibernate validator 依赖下面三个包. 而后两个已经在tomcat中存在.不需要单独加入.
<!-- Hibernate Validator start -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.3.4.Final</version>
</dependency>
<!-- 包冲突 -->
<!-- <dependency>
<groupId>javax.el</groupId>
<artifactId>javax.el-api</artifactId>
<version>2.2.4</version>
</dependency> -->
<!-- <dependency>
<groupId>org.glassfish.web</groupId>
<artifactId>javax.el</artifactId>
<version>2.2.4</version>
</dependency> -->
<!-- Hibernate Validator end -->
当Tomcat启动Web应用时,由于classloader在加载javax.el.ExpressionFactory的实现类时发现存在多个不同的实现,导致报错。解决此问题的关键在于检查Maven的依赖关系,避免引入与Tomcat内置库冲突的EL实现,如hibernate-validator的依赖。通过排除javax.el-api和javax.el的特定版本依赖,可以消除冲突,确保正常启动。

1512

被折叠的 条评论
为什么被折叠?



