严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/1_demo_war]]
报错代码
严重 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[/1_demo_war]]
报错截图
探究原因
在src/main/webapp/WEB-INF/web.xml文件中配置Servlet时,映射地址中没有/
解决方法
正确示范
xml
<servlet>
<servlet-name>test1</servlet-name>
<servlet-class>com.example.demo.TestServlet1</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>test1</servlet-name>
<url-pattern>/test1</url-pattern>
</servlet-mapping>