gpt4 book ai didi

tomcat - 如何使用 Ant 的 DeployTask 将 Web 应用程序部署到 Tomcat?

转载 作者:行者123 更新时间:2023-11-28 21:49:50 25 4
gpt4 key购买 nike

$ ant deploy
Buildfile: /Users/simpatico/SOLR_HOME/build.xml

deploy:

BUILD FAILED
/Users/simpatico/SOLR_HOME/build.xml:531: java.io.IOException: Server returned HTTP response code: 403 for URL: http://localhost:8080/manager/deploy?path=%2Fsolr
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1436)
at org.apache.catalina.ant.AbstractCatalinaTask.execute(AbstractCatalinaTask.java:228)

Total time: 2 seconds

在 build.xml 中:

<!--http://tomcat.apache.org/tomcat-5.5-doc/manager-howto.html#Executing_Manager_Commands_With_Ant-->
<!-- Configure properties to access the Manager application -->
<property name="url" value="http://localhost:8080/manager"/>
<property name="username" value="admin"/>
<property name="password" value="admin"/>

<!-- Configure the custom Ant tasks for the Manager application -->
<taskdef name="deploy" classname="org.apache.catalina.ant.DeployTask"/>

<!-- Configure the context path for this application -->
<property name="path" value="solr"/>

<target name="deploy" description="Install web application"
>
<deploy url="${url}" username="${username}" password="${password}"
path="${path}" war="file:${dist}/solr.war"/>
</target>

/solr 和 solr 路径都不起作用。

<tomcat-users>
<role rolename="manager-gui"/>
<user password="admin" roles="manager-gui,manager-script,admin" username="admin"/>
</tomcat-users>

编辑:现在无法部署,因为该应用程序已存在于路径/solr

undeploy: [undeploy] OK - Undeployed application at context path /solr

deploy: [deploy] FAIL - Application already exists at path /solr

BUILD FAILED /Users/simpatico/SOLR_HOME/build.xml:532: FAIL - Application already exists at path /solr

最佳答案

如果您查看 Manager App 的文档页面,您可以看到主要区别在于脚本的 url。该示例使用(注意 /text 部分):

<property name="url"      value="http://localhost:8080/manager/text"/>

在 *nix 环境中,您必须检查运行服务器的用户,以及该用户是否具有更改 Web 目录下文件的正确权限。

关于tomcat - 如何使用 Ant 的 DeployTask 将 Web 应用程序部署到 Tomcat?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5880603/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com