Reputation: 11107
$ 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
In 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>
Both a path of /solr and solr don't work.
<tomcat-users>
<role rolename="manager-gui"/>
<user password="admin" roles="manager-gui,manager-script,admin" username="admin"/>
</tomcat-users>
EDIT: now it fails to deploy becauase the app already exists at path /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
Upvotes: 4
Views: 10415
Reputation: 1593
<target name="tomcatdeploy" description="Install web application" >
<deploy_tomcat url="${admin.url}" username="${admin.name}" password="${admin.password}" path="/${webapp}" war="file:${dropoff.warfile.dir}/${webapp}.war"/>
</target>
<target name="check-context">
<available file="${app.base.dir}/${webapp}.war" property="context.present"/>
</target>
<target name="undeploy" depends="check-context" if="context.present" description="Remove web application" >
<undeploy_tomcat url="${admin.url}" username="${admin.name}" password="${admin.password}" path="/${webapp}"/>
</target>
First call "undeploy" then "tomcatdeploy" ant tasks. You have to provide ${pamram} values as necessary. "undeploy" task will check if given war file exists in the webapps directory, if so it will do actual un-deploying.
Upvotes: 0
Reputation: 20343
If you check out the documentation page of the Manager App, you can see the main difference is the url of the script. The example uses (mind the /text
part):
<property name="url" value="http://localhost:8080/manager/text"/>
In a *nix environment you have to check what user runs the server, and if that user has the correct permissions to alter files under your web directory.
Upvotes: 3