尝试将 Web 应用程序部署到计算机上安装的 tomcat 7.0.35 服务器实例时,我收到了一系列错误消息。该应用程序是使用 eclipse 在 jsp 中开发的。
我收到的第一条错误消息是:
FAIL - Encountered exception javax.management.RuntimeOperationsException: Exception invoking method check
在我尝试在 tomcat 管理器应用程序中部署应用程序后出现上述错误消息。
我在工作区中应用程序的根文件夹中放置了一个名为 myapp.xml 的 xml 文件,其内容为:
<Context path="/myapp" docBase="d:\path\to\myapp"/>
我尝试了多种不同的方法来解决此错误消息,但没有任何效果。一段时间后,错误消息也开始出现。
最后,每隔几秒钟,控制台就会刷新大量来自其持续重试的新错误消息,这些错误消息包括以下内容:
Feb 8, 2013 10:38:19 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor d:\mypath\apache-tomcat-7.0.35\conf\Catalina\localhost\myapp.xml
Feb 8, 2013 10:38:19 PM org.apache.catalina.startup.HostConfig deployDescriptor
SEVERE: Error deploying configuration descriptor d:\mypath\apache-tomcat-7.0.35\conf\Catalina\localhost\myapp.xml
java.io.FileNotFoundException: d:\mypath\apache-tomcat-7.0.35\conf\Catalina\localhost\myapp.xml (Access is denied)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(Unknown Source)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:608)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1637)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Feb 8, 2013 10:38:19 PM org.apache.catalina.startup.HostConfig deployDescriptors
SEVERE: Error waiting for multi-thread deployment of context descriptors to complete
java.util.concurrent.ExecutionException: java.lang.NullPointerException
at java.util.concurrent.FutureTask$Sync.innerGet(Unknown Source)
at java.util.concurrent.FutureTask.get(Unknown Source)
at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:579)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:475)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1449)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:301)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1374)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
at org.apache.catalina.startup.HostConfig.addWatchedResources(HostConfig.java:1172)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:706)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1637)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask$Sync.innerRun(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
... 1 more
当 tomcat 在 tomcat 文件夹中查找 myapp.xml 时,似乎会引发空指针错误。但它似乎没有看到 myapp.xml 位于我的 Eclipse 工作区中,位于我在 tomcat 管理器应用程序中提供的 d:\path\to\myapp url,如上所示。随着我不断尝试新事物,问题似乎越来越严重。
谁能告诉我如何解决所有这些问题,以便我可以在 tomcat 上部署我的应用程序?在此之前,我已经使用类似的方法在此服务器上部署了其他应用程序而没有问题。