我打开了一个Tomcat服务器并尝试在浏览器中访问localhost:8080,但我看到的只是空白。当我尝试访问像localhost:8080 /缺少的东西时,也会发生这种情况,因为我不会存在,所以我会看到404.另一件事是,当Mozilla只显示空白时,Chrome会发出以下消息:“此本地主页不能是发现”。我现在知道它是否相关,但是当我打开服务器时,我得到以下堆栈跟踪:
10-Jul-2017 11:45:06.353 SEVERE [localhost-startStop-1] org.apache.catalina.core.ContainerBase.addChildInternal ContainerBase.addChild: start:
org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:162)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1129)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1871)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name UploaderForm
at org.apache.catalina.core.StandardContext.addServletMappingDecoded(StandardContext.java:3191)
at org.apache.catalina.core.StandardContext.addServletMappingDecoded(StandardContext.java:3182)
at org.apache.catalina.startup.ContextConfig.configureContext(ContextConfig.java:1385)
at org.apache.catalina.startup.ContextConfig.webConfig(ContextConfig.java:1198)
at org.apache.catalina.startup.ContextConfig.configureStart(ContextConfig.java:783)
at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:307)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:95)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5213)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
... 10 more
10-Jul-2017 11:45:06.354 SEVERE [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Error deploying web application directory G:\Tomcat\apache-tomcat-8.0.45\webapps\ROOT
java.lang.IllegalStateException: ContainerBase.addChild: start: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Catalina].StandardHost[localhost].StandardContext[]]
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:757)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1129)
at org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1871)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
我提到我在Windows 10上使用Java 8和Tomcat 8.0.45。
答案 0 :(得分:2)
感谢Luciano,我设法解决了,所以问题是我的web.xml中的这个条目:
<servlet-mapping>
<servlet-name>UploaderForm</servlet-name>
<url-pattern>/UploaderForm</url-pattern>
</servlet-mapping>
它不应该存在,因为UploaderForm不是servlet,只是ROOT目录中的html表单。 这也在堆栈跟踪的第14行中指定:
Caused by: java.lang.IllegalArgumentException: Servlet mapping specifies an unknown servlet name UploaderForm