报错信息
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 -->