异常展示:
Description:
An attempt was made to call the method javax.servlet.jsp.tagext.TagAttributeInfo.<init>(Ljava/lang/String;ZLjava/lang/String;ZZLjava/lang/String;ZZLjava/lang/String;Ljava/lang/String;)V but it does not exist. Its class, javax.servlet.jsp.tagext.TagAttributeInfo, is available from the following locations:
jar:file:/Users/Macx/repository/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar!/javax/servlet/jsp/tagext/TagAttributeInfo.class
jar:file:/Users/Macx/repository/org/apache/tomcat/embed/tomcat-embed-jasper/8.5.34/tomcat-embed-jasper-8.5.34.jar!/javax/servlet/jsp/tagext/TagAttributeInfo.class
It was loaded from the following location:
file:/Users/Macx/repository/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar
Action:
Correct the classpath of your application so that it contains a single, compatible version of javax.servlet.jsp.tagext.TagAttributeInfo
从描述的异常可以猜想出,是jsp-api的jar出现了问题!
思考方向,jar不存在,在网上找了好多个都是说让把仓库中的jar删除,从新导入,然后再次下载。
照做之后,依然解决不到问题。
再次分析问题:异常描述中出现了jsp-api,又出现了tomcat,猜想方向,是不是两者冲突了,怀疑没有设置provided
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
检查之后发现,已经了scope,理论上并不应该存在冲突啊?
猜想方向,还是在冲突这里,应该是配置有问题,各种检查!
各种比对发现,mac的idea上的tomcat有个这个东西,provided????
为什么会有这个,取消之后,再次运行之后,解决问题。。。。
分析一下结果:
我在我的jsp-api jar包上加上scope provided,意味着这个jar包只能在编译和测试时候使用,当我启动tomcat的时候,就不会出现冲突了,可是我勾选上了Include dependencies with “Provided” scope之后,它把我的provided也打包进入了tomcat,这样就会出现了冲突。
个人观点,欢迎指正!