java.lang.IllegalArgumentException: 文档库 tomcat\webapps\appdata 不存在或不是可读目录

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/10935334/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-10-31 03:08:40  来源:igfitidea点击:

java.lang.IllegalArgumentException: Document base tomcat\webapps\appdata does not exist or is not a readable directory

javatomcatwar

提问by IAmYourFaja

I had a WAR previously deployed on my local Tomcat (6.0.35) instance called appdata.war, and so the webapps directory looked like:

我之前在本地 Tomcat (6.0.35) 实例上部署了一个名为 的 WAR appdata.war,因此 webapps 目录如下所示:

webapps/
    docs/
    examples/
    host-manager/
    manager/
    appdata/ (exploded WAR)
    ROOT/
    appdata.war

I deleted appdata/and appdata.war(so that Tomcat wouldn't try to redeploy it) and then added a new war (appmon-qa.war) to this directory. I then ran the Tomcat startup script and saw deployment errors referencing the "old" appdataWAR. I poked around and saw a folder with that name located at ${TOMCAT.HOME}/work/Catalina/localhost/appdataand I deleted it (again, just to prevent Tomcat from re-deploying it). I then re-ran the startup scripts and am seeing this in the catalina log:

我删除了appdata/and appdata.war(这样 Tomcat 就不会尝试重新部署它),然后向该appmon-qa.war目录添加了一个新的 war ( )。然后我运行了 Tomcat 启动脚本,看到了引用“旧” appdataWAR 的部署错误。我四处张望,看到一个名为 的文件夹,${TOMCAT.HOME}/work/Catalina/localhost/appdata我将其删除(再次,只是为了防止 Tomcat 重新部署它)。然后我重新运行了启动脚本,并在 catalina 日志中看到了这一点:

SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base C:\Program Files\Apache\apache-tomcat-6.0.35\webapps\appdata does not exist or is not a readable directory
    at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:        
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4320)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4489)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:799)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:779)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:601)
    ...rest of stacktrace omitted for brevity
Jun 7, 2012 11:35:27 AM org.apache.catalina.core.StandardContext start
SEVERE: Error in resourceStart()
Jun 7, 2012 11:35:27 AM org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
Jun 7, 2012 11:35:27 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/appdata] startup failed due to previous errors
Jun 7, 2012 11:35:27 AM org.apache.catalina.core.StandardContext stop
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/appdata] has not been started
Jun 7, 2012 11:35:27 AM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive appmon-qa.war
Jun 7, 2012 11:35:28 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Jun 7, 2012 11:35:28 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/appmon-qa] startup failed due to previous errors

I assumethat my oh-so-perfectly-written appmon-qa.warapp is failing to deploy because of some ghost reference to this old appdata.warapp. If so, do I (properly) undeploy or delete it from Tomcat altogether so that it doesn't cause problems for my new app?

假设我写的如此完美的appmon-qa.war应用程序无法部署,因为对这个旧appdata.war应用程序有一些幽灵引用。如果是这样,我是否(正确)从 Tomcat 中完全取消部署或删除它,以便它不会对我的新应用程序造成问题?

Otherwise, if this log output indicates that there is something wrong with appmon-qa.waritself, then where do I start debugging? Usually these "failed due to previous errors" output also includes a reason or source of what the errors are; this output is pretty undescriptive and vague. Thanks in advance!

否则,如果这个日志输出表明appmon-qa.war本身有问题,那么我从哪里开始调试?通常这些“由于先前的错误而失败”的输出还包括错误的原因或来源;此输出非常不具描述性且含糊不清。提前致谢!

回答by adarshr

Take a look at ${TOMCAT.HOME}/conf/Catalina/localhost/appdata.xmland delete it if it exists.

查看${TOMCAT.HOME}/conf/Catalina/localhost/appdata.xml并删除它,如果它存在。

回答by Cliff J.

I had this same error (Document base ... does not exist or is not a readable directory). The easy solution was to re-install Tomcat over the existing one (ignore the warning "cannot install service" because it is already there).

我有同样的错误(文档库...不存在或不是可读目录)。简单的解决方案是在现有的 Tomcat 上重新安装 Tomcat(忽略警告“无法安装服务”,因为它已经存在)。