1

我有一个在 CentOS 6 机器上运行的 tomcat6 服务器,到目前为止一切都很好。在我的一个 webapps 中,我需要使用上下文参数来访问位于文件系统中的外部文件夹,我像这样配置了我的 server.xml(<Host>仅标签的相关部分):

<Context path="/userimages" docBase="/home/someuser/faces/32x32" debug="0" reloadable="true" crossContext="true"/>

当我启动服务器时,我收到此错误:

java.lang.IllegalArgumentException: Document base /home/someuser/faces/32x32 does not exist or is not a readable directory

我读了一些关于文件夹权限的东西,所以我将“32x32”和“webapps”文件夹都设置为 777,但它仍然无法正常工作......知道如何解决这个问题吗?

PS在windows操作系统上运行完美

4

1 回答 1

0

My suggestion is to put your data into /usr/share/tomcat6/conf/context.xml which is a symlink to /etc/tomcat6/context.xml on CentOS 6. At least tomcat6 does read the contents of that file when it restarts, and I had some luck getting resource data loaded from there. It would seem that this file is new in tomcat6.

I used strace to check which files it was visiting and it does run stat() on the various files like /var/lib/tomcat6/webapps/*/META-INF/context.xml but nowhere does it actually open() those files, so I'm pretty sure it does not read the contents. Maybe some bug? Maybe imaginary future feature?

I managed to get Plandora (uses context to supply MySQL database connection details) running on CentOS 6 with these packages (from yum):

apache-tomcat-apis-0.1-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.61.1.11.11.el6_4.i686
mysql-connector-java-5.1.17-6.el6.noarch
tomcat6-6.0.24-52.el6_4.noarch
tomcat6-servlet-2.5-api-6.0.24-52.el6_4.noarch
tomcat6-el-2.1-api-6.0.24-52.el6_4.noarch
tomcat6-admin-webapps-6.0.24-52.el6_4.noarch
tomcat6-jsp-2.1-api-6.0.24-52.el6_4.noarch
tomcat6-lib-6.0.24-52.el6_4.noarch
tomcat6-webapps-6.0.24-52.el6_4.noarch

Just in case anyone else is trying to get Plandora to work on CentOS 6, you also need to make sure you symlink:

 ln -s /usr/share/java/mysql-connector-java.jar /usr/share/tomcat6/lib/
于 2013-05-17T07:52:19.947 回答