我正在使用Apache Tomcat 7将我的项目部署到AWS。我将ROOT.xml
添加到Catalina/localhost/
这样
<Context
path="/"
docBase="/home/ec2-user/myproject/web"
workDir="/home/ec2-user/myproject/work"
crossContext="true">
</Context>
启动Tomcat给了我Tomcat的着名例外,但遗憾的是,我无法解决它
java.lang.IllegalArgumentException: Document base /home/ec2-user/myproject/web does not exist or is not a readable directory
at org.apache.naming.resources.FileDirContext.setDocBase(FileDirContext.java:136)
at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:5247)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5436)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:899)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:875)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:652)
at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:679)
at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1966)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:473)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622)
at java.lang.Thread.run(Thread.java:748)
我尝试的事情:
sudo chown -R tomcat:tomcat web && sudo chmod 775 -R web
(不是
工作)sudo ln -s web /etc/tomcat/web
(不起作用)sudo cp -rf web /etc/tomcat/web
(工作,实际上,如果我搬家了
web
之外的/home/ec2-user
文件夹,它开始工作)如何使用web
下的ec2-user
文件夹
答案 0 :(得分:0)
问题解决了。从
修改/etc/tomcat7/tomcat7.conf
TOMCAT_USER="tomcat"
到
TOMCAT_USER="root"
不是最好的方法,但我现在可以继续工作了