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

用tomcat运行就报错了啊


HTTP Status 500 - 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"

type Exception report

message 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"

description The server encountered an internal error that prevented it from fulfilling this request.

exception

javax.servlet.ServletException: 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"
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:343)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)


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"
java.lang.Class.getDeclaredMethods0(Native Method)
java.lang.Class.privateGetDeclaredMethods(Class.java:2531)
java.lang.Class.getDeclaredMethods(Class.java:1855)
org.apache.catalina.util.Introspection.getDeclaredMethods(Introspection.java:127)
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:172)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:390)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:334)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)


正在回答

3 回答

使用package命令打包项目——使用了jetty这个插件(在Maven的中央插件库中寻找)作为Web容器

在中央仓库查找jetty的plugin坐标配置到pom.xml中

pom.xml例子:

  <build>

    <finalName>webbproject-demo</finalName>

    <plugins>

<plugin>

  <groupId>org.mortbay.jetty</groupId>  

  <artifactId>jetty-maven-plugin</artifactId>  

  <version>2.1.1</version>

  <executions>

<execution>

<!-- 在打包成功后使用jetty:run来运行jetty服务 -->

  <phase>package</phase>

  <goals>

 <goal>run</goal>

  </goals>

</execution>

  </executions>

</plugin>

</plugins>

  </build>

你看看吧,不行的话,你在看看视频吧!我以尽力!

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

在看看视频吧,我也是自学,我也好多不会啊!

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

fenkapian 提问者

嗯 一直没停
2016-12-04 回复 有任何疑惑可以回复我~

你是不是没有注释jetty啊,要注释jetty,在安装Tomcat 的Maven Plugin 才能运行。

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

fenkapian 提问者

在哪注释啊?这是慕课网上maven教程里的实例 视频里没安装插件也能运行啊
2016-11-29 回复 有任何疑惑可以回复我~

举报

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

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

进入课程

用tomcat运行就报错了啊

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