本文介绍了Tomcat 6 拒绝有效的 docBase的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我的 webapp 上下文文件,/etc/tomcat6/Catalina/localhost/ri.xml

This is my webapp context file, /etc/tomcat6/Catalina/localhost/ri.xml

<Context docBase="/home/bart/Dropbox/projects/RevoraIndieSite/webapp" reloadable="true">

</Context>

然而,Tomcat 抱怨:

However, Tomcat complains:

INFO: Deploying configuration descriptor ri.xml
28-Apr-2011 23:44:04 org.apache.catalina.core.StandardContext resourcesStart
SEVERE: Error starting static Resources
java.lang.IllegalArgumentException: Document base /home/bart/Dropbox/projects/RevoraIndieSite/webapp does not exist or is not a readable directory
    at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:142)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:4249)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4418)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:546)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
    at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1345)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:303)
    at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
    at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1337)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1601)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1610)
    at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1590)
    at java.lang.Thread.run(Thread.java:636)
28-Apr-2011 23:44:04 org.apache.catalina.core.StandardContext start
SEVERE: Error in resourceStart()
28-Apr-2011 23:44:04 org.apache.catalina.core.StandardContext start
SEVERE: Error getConfigured
28-Apr-2011 23:44:04 org.apache.catalina.core.StandardContext start
SEVERE: Context [/ri] startup failed due to previous errors
28-Apr-2011 23:44:04 org.apache.catalina.core.StandardContext stop
INFO: Container org.apache.catalina.core.ContainerBase.[Catalina].[localhost].[/ri] has not been started

但是该目录存在,并且对所有人可读.

But the directory exists, and is readable for everyone.

bart@bart-laptop:~$ ls -l /home/bart/Dropbox/projects/RevoraIndieSite
total 36
drwxr-xr-x 3 bart bart 4096 2011-04-20 20:46 bin
drwxr-xr-x 3 bart bart 4096 2011-04-27 23:11 bin-tools
-rw-r--r-- 1 bart bart  971 2011-04-27 23:15 build.xml
drwxr-xr-x 4 bart bart 4096 2011-03-30 22:42 export
-rw-r--r-- 1 bart bart  290 2011-03-30 22:36 ivysettings.xml
-rw-r--r-- 1 bart bart 1214 2011-04-27 23:08 ivy.xml
drwxr-xr-x 4 bart bart 4096 2011-04-28 23:33 src
drwxr-xr-x 3 bart bart 4096 2011-04-27 22:09 src-tools
drwxr-xr-x 3 bart bart 4096 2011-02-27 17:33 webapp

这是来自 Ubuntu 10.10 存储库的默认 Tomcat 6 安装,没有其他更改.

It's a default Tomcat 6 installation from the Ubuntu 10.10 repository, with no other changes.

推荐答案

webapp 目录也需要写权限.此外,将此目录的所有者设置为与运行 tomcat 实例的所有者相同(如果我没记错的话,这是 ubuntu 上的 tomcat6 用户)所以试试
chown -R tomcat6:tomcat6 webapps
或为他人授予 webapps 的写权限
chmod 766 webapps

webapp directory needs write permisson as well. Furthermore it is a good practice to set owner of this directory as the same that runs tomcat instance (which is tomcat6 user on ubuntu if i am not wrong)so try
chown -R tomcat6:tomcat6 webapps
or give write permisson to webapps forlder for others
chmod 766 webapps

这篇关于Tomcat 6 拒绝有效的 docBase的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-10 08:35