Server Tomcat v8.0 Server at localhost failed to start.
来源:互联网 发布:python入门经典 网盘 编辑:程序博客网 时间:2024/04/29 12:44
1..看到上面的黑体字了吗?
哪里就是出现该错误的原因。
Caused by: java.lang.IllegalArgumentException: The servlets named [helloworld] and [HelloWorld] are both mapped to the url-pattern [/HelloWorld] which is not permitted
at org.apache.tomcat.util.descriptor.web.WebXml.addServletMapping(WebXml.java:308)
2..Servlet的时候eclipse已经帮助建好了url-patten。
@WebServlet("/HelloWorld")
public class HelloWorld extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#HttpServlet()
*/
public HelloWorld() {
super();
// TODO Auto-generated constructor stub
}
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
doPost(request,response);
}
/**
* @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
*/
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
// TODO Auto-generated method stub
String u_name=request.getParameter("u_name");
String ad="Welcome,"+u_name;
request.setAttribute("ad", ad);
request.getRequestDispatcher("/welcome.jsp").forward(request, response);
}
}
3..打开你的Servlet类,你会发现在类上面有一个@WebServlet("/HelloWorld")。
如果你在web.xml里面这样写:
<servlet>
<servlet-name>helloworld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>helloworld</servlet-name>
<url-pattern>/HelloWorld</url-pattern>
</servlet-mapping>
就是报错。
4..解决方法一:
去掉类上面的@WebServlet("/HelloWorld")。在web.xml写<servlet-mapping>。
5..解决方法二:
在web.xml里不写 <servlet-mapping>,而要保留@WebServlet("/HelloWorld")。如下web.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1">
<display-name>HelloWorld</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>helloworld</servlet-name>
<servlet-class>HelloWorld</servlet-class>
</servlet>
</web-app>
- Server Tomcat v8.0 Server at localhost failed to start.
- Server Tomcat v8.0 Server at localhost failed to start.
- Server Tomcat v8.0 Server at localhost failed to start.
- Server Tomcat v8.0 Server at localhost failed to start.
- Server Tomcat v8.0 Server at localhost failed to start.
- Server Tomcat v8.0 Server at localhost failed to start.
- Server Tomcat v8.0 Server at localhost failed to start
- Server Tomcat v8.0 Server at localhost failed to start.
- Server Tomcat v8.0 Server at localhost failed to start.
- Server Tomcat v8.0 Server at localhost failed to start
- 解决Tomcat v8.0 Server at localhost failed to start.
- Server Tomcat v8.5 Server at localhost failed to start.
- Server Tomcat v8.5 Server at localhost failed to start.
- "server tomcat v8.0 server at localhost failed to start"+"A child container failed during start"
- tomcat启动失败 ----Server Tomcat v8.0 Server at localhost failed to start.
- tomcat 启动失败问题:Server Tomcat v8.0 Server at localhost failed to start.
- 初次加载tomcat,Server Tomcat v8.0 Server at localhost failed to start
- 关于Server Tomcat v8.0 Server at localhost failed to start的解决办法
- 由SDK版本引起的bug及自己易犯的错误
- 海量数据找中位数
- 编程技术面试的五大要点
- 浅谈JAVA和C++两者的参数传递
- Android:实现点击图片时图片变暗的效果
- Server Tomcat v8.0 Server at localhost failed to start.
- 数组最大差值以及不用除法求比例
- ASI 与 AFN的区别要点
- Android Parcelable
- 从远程库克隆
- hihocoder1233 搜索+状态压缩 我是菜比
- 数据结构与算法分析2.16
- eclipse中导入web项目变成java项目解决办法
- <leetcode系列> Count And Say