使用tomcat客户端部署程序部署时出现403错误

时间:2011-07-20 10:11:28

标签: deployment tomcat7

使用Tomcat Client Deployer(TCD)和本地Tomcat安装时遇到一些麻烦。具体来说,我在尝试部署一个简单的helloworld Web应用程序时遇到403错误,这导致我得出的结论是我的tomcat-users.xml不太合适。

我只是看不出它是什么。

这是相关的build.xml片段:

<!-- Configure the folder and context path for this application -->
<property name="webapp"   value="helloworld"/>
<property name="path"     value="/helloworld"/>
<!-- Configure properties to access the Manager application -->
<property name="url"      value="http://localhost:8080/manager/text"/>
<property name="username" value="deploymgr"/>
<property name="password" value="s3cret"/>

Tomcat的users.xml中:

</tomcat-users>
  <role rolename="manager-gui"/>
  <role rolename="manager-script"/>
  <role rolename="manager-jmx"/>
  <role rolename="manager-status"/>
  <role rolename="tomcat"/>
  <user username="deploymgr" password="s3cret" roles="manager-script"/>
  <user username="tomcat" password="tomcat" roles="tomcat, manager-gui, manager-jmx, manager-status"/>
</tomcat-users>

deployer.properties:

build=D:/apache-tomcat-7.0.16-deployer/work
webapp=D:/apache-tomcat-7.0.16-deployer/helloworld/
path=/helloworld
url=http://localhost:8080/manager
username=deploymgr
password=s3cret

当我尝试部署应用程序时,收到以下错误消息:

D:\apache-tomcat-7.0.16-deployer>ant deploy
Buildfile: D:\apache-tomcat-7.0.16-deployer\build.xml
Trying to override old definition of datatype resources

deploy:
     [echo] name: deploymgr, pass: s3cret, url: http://localhost:8080/manager

BUILD FAILED
D:\apache-tomcat-7.0.16-deployer\build.xml:92: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/deploy?path=%2Fhelloworld&update=true

我发现奇怪的是,错误消息URL包含“%2F”而不是正斜杠...可能是用户配置实际上是正确的,我只是因为URL转义码而得到403 ? (我在Windows Vista下工作)

有人可以帮我解决这个问题吗?哦,当然应用程序通过用户界面完美地部署:-1

非常感谢。

1 个答案:

答案 0 :(得分:1)

可能是这个问题的更新......我在deployer.properties文件中犯了一个错误。参数“url”必须与上面的build.xml相同。

deployer.properties正确:

build=D:/apache-tomcat-7.0.16-deployer/work
webapp=D:/apache-tomcat-7.0.16-deployer/helloworld/
path=/helloworld
url=http://localhost:8080/manager/text
username=deploymgr
password=s3cret

现在有效!