新建servlet后再配置web.xml后tomcat不能启动,报错:Caused by: org.apache.catalina.LifecycleException: Failed to star
来源:互联网 发布:中国有多安全 知乎 编辑:程序博客网 时间:2024/06/01 08:09
我惊奇的发现在eclipse中新建一个servlet文件,只要一行代码就可以省去了一个web.xml的配置,正是这行代码导致了tomcat不能正常启动,并且报错。
web.xml文件
<?xml version="1.0" encoding="UTF-8"?>
<web-app
xmlns:xsi="http://www.w3.org/2001/XMLSchema-
instance" xmlns="http://java.sun.com/xml/ns/javaee"
xsi:schemaLocation="http://java.sun.com/xml/ns/java
ee http://java.sun.com/xml/ns/javaee/web-
app_3_0.xsd" version="3.0">
<servlet>
<servlet-name>HelloWorldServlet</servlet-name>
<servlet-
class>com.servlet.HelloWorldServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>HelloWorldServlet</servlet-name>
<url-pattern>/HelloWorldServlet</url-pattern>
</servlet-mapping>
</web-app>
而在servlet里面添加一句@WebServlet("/HelloWorldServlet")就可以了
,ps:这个和web.xml不能同时配置,否则tomcat不能启动,报的错是:
严重: A child container failed during start
java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/test]]
Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalin .
开始网上说是web.xml的错误,后来发现原来是servlet类中配置了@WebServlet("/HelloWorldServlet"),再次配置
web.xml就有冲突了。不知道大家是什么错误。
- 新建servlet后再配置web.xml后tomcat不能启动,报错:Caused by: org.apache.catalina.LifecycleException: Failed to star
- tomcat 启动报错org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalin
- Tomcat启动报错:org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalin
- Caused by: org.apache.catalina.LifecycleException: A child container failed
- Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalin
- Tomcat启动报错: : org.apache.catalina.LifecycleException
- tomcat 启动 maven 报错 org.apache.catalina.LifecycleException
- Caused by: org.apache.catalina.LifecycleException:eclipse中的tomcat启动不了解决之一。
- 关于tomcat启动 报tomcat org.apache.catalina.LifecycleException异常
- tomcat org.apache.catalina.LifecycleException: Failed to start component
- tomcat org.apache.catalina.LifecycleException: Failed to start component
- 每日一得--web项目报org.apache.catalina.LifecycleException: Failed to start component [StandardEngine...
- tomcat 启动错误 Error listenerStart org.apache.catalina.LifecycleException: Failed to start component
- 报错java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start c
- Caused by: org.apache.catalina.LifecycleException: A child container failed during start
- 编译运行在Tomcat时报错org.apache.catalina.LifecycleException: Failed to start component
- Shiro servlet启动报错 Failed to initialize component [org.apache.catalina.webresources.JarResource@xxxx
- tomcat启动报错java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException?
- 搞axis2
- Ubuntu 10.10下挂载的window盘符无法获得可执行权限的问题
- PHP导入Excel到MySQL的方法
- dijkstra算法与prim算法的区别
- 网页设计师非常有用的几个在线工具
- 新建servlet后再配置web.xml后tomcat不能启动,报错:Caused by: org.apache.catalina.LifecycleException: Failed to star
- 常见linux系统调用
- 快排实现;
- java io和nio
- 求数组的最长递增子序列
- javascriptmvc—优秀代码
- java 正则表达式语法
- PHY芯片
- MariaDB