开发者社区> 问答> 正文

tomcat7-maven-plugin运行项目报错java.lang.Link?400报错

java.lang.LinkageError: loader constraint violation: loader (instance of org/apache/jasper/servlet/JasperLoader) previously initiated loading for a different type with name "javax/servlet/http/HttpServletRequest"
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
    at java.lang.Class.getDeclaredMethods(Unknown Source)
    at org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:127)
    at org.apache.catalina.core.DefaultInstanceManager.populateAnnotationsCache(DefaultInstanceManager.java:342)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:161)
    at org.apache.catalina.core.DefaultInstanceManager.newInstance(DefaultInstanceManager.java:149)
    at org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
    at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
    at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1041)
    at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:603)
    at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

使用maven-compiler-plugin运行项目总是报上面的错误,,经过百度,多数是说在maven的pom.xml中给包加上<scope>provided</scope>,,我怎么加都不行,,尝试过不在pom.xml中导包,直接手动导包,,运行项目也是报这个错?这是什么运用呢?

展开
收起
爱吃鱼的程序员 2020-06-08 15:01:20 708 0
1 条回答
写回答
取消 提交回答
  • https://developer.aliyun.com/profile/5yerqm5bn5yqg?spm=a2c6h.12873639.0.0.6eae304abcjaIB

    应该是jar包冲突了吧,我看你上面好像有两个不同版本的servlet包

    我只引入servlet-api2.5和jsp-api2.0版本也是报上面的错误

    项目/WEB-INF/lib目录下 jsp-api.jar,el-api.jar,servlet-api.jar要移除

    看下运行目录下的项目/WEB-INF/lib目录下有类似jsp-api.jar,el-api.jar,servlet-api.jar包么?检查下依赖,看看其它包是否依赖了jsp相关的包,比如solr。有的话需要exclusion/WEB-INF/lib目录下jsp-/WEB-INF/lib目录下我没有放jsp-api.jar,el-api.jar,servlet-api.jarapi.jar,el-api.jar,servlet-api.jar

    楼主。问题是否已经解决了,我也遇到了该问题。请问怎么解决的

    2020-06-08 15:01:31
    赞同 展开评论 打赏
问答排行榜
最热
最新

相关电子书

更多
从《阿里巴巴Java开发手册》编写推广谈技术成长 立即下载
如何通过 Serverless 提高 Java 微服务治理效 立即下载
Spring Cloud Alibaba - 重新定义 Java Cloud-Native 立即下载

相关镜像