为了账号安全,请及时绑定邮箱和手机立即绑定

用maven启动tomcat问题

严重: Servlet.service() for servlet [jsp] in context with path [/webdemo] threw exception [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"] with root cause

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(Class.java:2701)

at java.lang.Class.getDeclaredMethods(Class.java:1975)

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(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at java.lang.Thread.run(Thread.java:745)



正在回答

6 回答

如果用tomcat 就不用继续用这个 <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>javax.servlet-api</artifactId>
    <version>3.0.1</version>
    <scope>provided</scope>
</dependency>

0 回复 有任何疑惑可以回复我~

我把servlet依赖删了依然报错,于是把jetty那个打包后启动也删掉了,重启成功。

0 回复 有任何疑惑可以回复我~

     <groupId>javax.servlet</groupId>

    <artifactId>javax.servlet-api</artifactId>

    <version>3.0.1</version>

    <!-- 只在编译和测试中运行 -->

    <scope>provided</scope>  <!--这一句是不是没写,写了就不会造成冲突-->


1 回复 有任何疑惑可以回复我~

顶一个,我也是这个问题。

0 回复 有任何疑惑可以回复我~
#1

用户1217623

请问你解决了没有
2016-09-04 回复 有任何疑惑可以回复我~

请问你最后解决了吗? 我也是这个问题,楼上那位朋友说的依赖冲突好像没有,只有junit和servlet两个依赖,然后junit有一个子依赖

0 回复 有任何疑惑可以回复我~
#1

用户1217623

请问你解决了没有
2016-09-04 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消
项目管理利器——maven
  • 参与学习       173090    人
  • 解答问题       742    个

使用maven来构建和管理Java项目,从环境配置,到maven核心知识

进入课程

用maven启动tomcat问题

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信