使用maven集成tomcat8插件后使用tomcat8:run运行web项目,
访问请求时即报此异常(完整异常):
HTTP Status 500 - java.lang.LinkageError: loader constraint violation: when resolving method “org.apache.jasper.runtime.InstanceManagerFactory.getInstanceManager(Ljavax/servlet/ServletConfig;)Lorg/apache/tomcat/InstanceManager;” 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 the method’s defining class, org/apache/jasper/runtime/InstanceManagerFactory, have different Class objects for the type org/apache/tomcat/InstanceManager used in the signature
提示大致意思是jar包冲突,而我相关的servlet与jsp的依赖的scope属性都是设的provided,在网上搜了很多解决办法后也无解。
后估计是版本原因造成,各种下降版本都无法解决,除了将tomcat8换为tomcat7。好不容易才换的tomcat8怎么忍心呢?强迫症又犯了,犯了也无用,请教了一位老师,也没遇到过。各种搜花了接近两天时间,还是放弃了。
无意中再抱了次希望不用tomcat8:run了,用tomcat8:run-war,访问ok了,具体原因是为啥去maven和tomcat插件说明里看了,没找到。管那多呢,解决了就行了吧。
有知道的朋友欢迎留言讨论,我也挺想知道为什么的。