You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by mi...@freddiemac.com on 2004/06/15 21:01:00 UTC

Tomcat deploy remote WAR via http

I'm running Tomcat 5.0. I'm trying to deploy a remote WAR file to my 
tomcat using the ManagerServlet's html commands. Since the WAR file is not 
on the local disk of the tomat server, I'm sending it a callback http URL 
to download the WAR file but it is not working. (I'm trying to automate 
pushing out builds from a build machine to target servers).

I'm refering to this info:
        http://jakarta.apache.org/tomcat/tomcat-4.1-doc/catalina/docs/api/org/apache/catalina/servlets/ManagerServlet.html
Where it explains that I can send arguments to the "deploy" command:
        /install?path=/xxx&war={war-url} 
where {war-url} can be:
        jar:http://hostname:port/path/to/a/warfile.war!/ 

Given that, I construct a URL to send to the manager servlet:
        http://myhost:8080/manager/html/deploy?deployPath=/bdm2&deployWar=jar:http://localhost:8080/bdm/bdm.war!/
And I promptly get the error:
        FAIL - Encountered exception java.lang.IllegalArgumentException: Invalid 
URL for web application archive: http://localhost:8080/bdm/bdm.war

In the log, I pull the stack trace:

java.lang.IllegalArgumentException: Invalid URL for web application 
archive: http://localhost:8080/bdm/GetWar?file=bdm.war
        at 
org.apache.catalina.core.StandardHostDeployer.install(StandardHostDeployer.java:215)
        at 
org.apache.catalina.core.StandardHost.install(StandardHost.java:832)
        at 
org.apache.catalina.manager.ManagerServlet.deploy(ManagerServlet.java:922)
        at 
org.apache.catalina.manager.HTMLManagerServlet.deployInternal(HTMLManagerServlet.java:273)
        at 
org.apache.catalina.manager.HTMLManagerServlet.doGet(HTMLManagerServlet.java:97)
[...]

So I pulled the src distribution for 5.0 and looked at 
StandardHostDeployer.java:215
I see lines 210 to 215:
        if (url.startsWith("file://"))
            docBase = url.substring(7);
        else if (url.startsWith("file:"))
            docBase = url.substring(5);
        else
            throw new IllegalArgumentException
                (sm.getString("standardHost.warURL", url));

This expects the URL to begin with "file:" instead of "http:". So it 
appears to me that, contrary to the documentation, Tomcat does not support 
getting a WAR file via http. 

Is that the case, or am I doing this wrong?

Thanks.