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

发布于 2024-11-25 05:40:55 字数 2031 浏览 2 评论 0原文

我在本地 Tomcat 安装中使用 Tomcat Client Deployer (TCD) 时遇到一些问题。具体来说,我在尝试部署一个简单的 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

提前非常感谢。

I have some trouble using Tomcat Client Deployer (TCD) with a local Tomcat installation. Specifically, I get a 403 error while trying to deploy a simple helloworld web application which leads me to the conclusion that something is not quite right with my tomcat-users.xml.

I just cannot see what it is.

here's the relevant build.xml snippet:

<!-- 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

and when I try to deploy the application, I get the following error message:

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

only thing I find weird is that the error message URL contains a "%2F" instead of a forward slash... could it be that the user configuration is actually correct, I get the 403 simply because of the URL escape code? (I'm working under Windows Vista)

Can someone help me out on this? Oh, and of course the application deploys flawlessly through the user interface :-1

Thanks very much in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

随风而去 2024-12-02 05:40:55

也许是关于这个问题的更新...我在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

现在可以了!

perhaps an update on this issue... I've made a mistake in the deployer.properties file. The parameter "url" has to be the same as in build.xml above.

deployer.properties correctly:

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

now it works!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文