我打开了一个Tomcat服务器并尝试在浏览器中访问localhost:8080,但我看到的都是空白的。当我尝试访问诸如 localhost:8080/missing 之类的内容时,也会发生这种情况,它不存在,所以我会看到 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:Tomcatapache-tomcat-8.0.45webappsROOT
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。
多亏了卢西亚诺,我设法解决了它,所以问题是我网站上的这个条目.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