蚂蚁安装部署的Tomcat Web应用程序与权限问题失败 [英] ant install to deploy Tomcat webapp failing with permission problem
问题描述
我一直沿着很好的Tomcat6 应用程序开发者指南<以下/ A>。我抓住了他们的的build.xml
,内含方便的ant任务安装使用
>卡塔利娜-的ant.jar
任务部署
。
I've been following along the very good Tomcat6 Application Developers Guide. I've grabbed their build.xml
which contains the handy ant task called install
that uses the catalina-ant.jar
task deploy
.
<target name="install" depends="compile"
description="Install application to servlet container">
<deploy url="${manager.url}"
username="${manager.username}"
password="${manager.password}"
path="${app.path}"
localWar="file://${build.home}"/>
</target>
我的项目目前坐落在 /家庭/雷夫/测试/ mytomcatapp /
。
我的 build.properties
如下:
manager.username=admin
manager.password=admin
manager.url=http://localhost:8080/manager/
cataline.home=/usr/share/tomcat6/
和我的 /etc/tomcat6/tomcat-users.xml
如下:
<role rolename="admin"/>
<role rolename="manager"/>
<user name="admin" password="admin" roles="admin,manager" />
但是,当我做我的蚂蚁安装
来测试我的web应用程序我得到一个错误部署它:
But, when I do my ant install
to test out my webapp I get an error deploying it:
$ ant install
Buildfile: build.xml
Trying to override old definition of datatype resources
prepare:
compile:
install:
[deploy] FAIL - Failed to deploy application at context path /mytomcatapp
BUILD FAILED
FAIL - Failed to deploy application at context path /mytomcatapp
而在 /var/log/tomcat/catalina.out
它说:
java.io.FileNotFoundException: /home/leif/test/mytomcatapp/build (Permission denied)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:137)
at org.apache.catalina.manager.ManagerServlet.copyInternal(ManagerServlet.java:1644)
at org.apache.catalina.manager.ManagerServlet.copy(ManagerServlet.java:1605)
at org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:819)
at org.apache.catalina.manager.ManagerServlet.doGet(ManagerServlet.java:350)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
at java.lang.Thread.run(Thread.java:636)
所以Tomcat管理不能访问我的家目录中的文件。没有什么令人震惊的存在。但是如何在蚂蚁安装
任务意想不到的工作?这当然是presuming人保持源$ C $ C为他们的项目在他们的家目录和EXCUTE 蚂蚁从该位置安装
。我宁愿不开曲柄的权限在我的主目录,必须有一个更好的办法?
So Tomcat manager can't access the files in my home dir. Nothing shocking there. But how is the ant install
task ever expected to work? This is of course presuming people keep the source code for their project in their home dir and excute ant install
from that location. I'd rather not crank open the permissions on my home dir, there must be a better way?
推荐答案
您需要打包你的webapp在.war文件中,并有蚂蚁上传到Tomcat。如果您使用的样本的build.xml ,只是有安装目标取决于 DIST
目标,并更改
You need package up your webapp in a .war file, and have ant upload it to Tomcat. If you're using the sample build.xml , just have the install target depend on the dist
target, and change
localWar="file://${build.home}"
到
war="${dist.home}/${app.name}-${app.version}.war"`
Alternativly,你的build.xml战争改变输出,你可以用Tomcat的共享目录 - 例如/ tmp下的某处
Alternativly, change your build.xml to output the war to a directory that you can share with tomcat - e.g. somewhere under /tmp
这篇关于蚂蚁安装部署的Tomcat Web应用程序与权限问题失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!