You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2009/09/17 17:53:32 UTC

DO NOT REPLY [Bug 47760] Ant deploy task's config attribute not working

https://issues.apache.org/bugzilla/show_bug.cgi?id=47760

--- Comment #2 from Uwe Günther <uw...@cscc.de> 2009-09-17 08:53:26 PDT ---
I did a bit of investigation in this one.:

1) It seems to me this isn't a bug.
2) It seems to me you are mixing up two different deployment methods. 

But let me explain it:

>From my point of view there is 

    a) a local  deployment functionality and
    b) a remote deployment functionality  

In a) you can deploy a war file or a webapp directory to a local installed
tomcat with or without a context fragment. Note: You have here a hard
precondition: All files are local to the tomcat you want to deploy to.

In this case your ant target should look like this:

  <target name="install" description="Install application in Tomcat">
    <available property="present" file="build/pr.xml" />
    <echo>present:${present}</echo>
    <deploy url="${tomcat.manager.url}"
            username="${tomcat.username}"
            password="${tomcat.password}"
            path="/${webapp.name}"
            localWar="../${dist.dir}/lib/${app.name}.war"
            config="build/pr.xml"/>
  </target>


In b) you can only deploy a war file via HTTP PUT to your remote tomcat
installation via the manager servlet. In this case you have to put your context
fragment (pr.xml in your case) in META-INF/context.xml in your *.war file. You
have to do this because it is not possible to upload a config file (context
fragment aka context.xml) to a remote server via the  manager webapp which gets
used by the deploy task.

In this case your ant target should look like this:

  <target name="install" description="Install application in Tomcat">
    <available property="present" file="build/pr.xml" />
    <echo>present:${present}</echo>
    <deploy url="${tomcat.manager.url}"
            username="${tomcat.username}"
            password="${tomcat.password}"
            path="/${webapp.name}"
            war="../${dist.dir}/lib/${app.name}.war"/>
  </target>


Note: In b) Your context fragment from build/pr.xml has to be in
${app.name}.war!/META-INF/context.xml. While the deployment it gets copied to
$CATALINA_BASE/conf/[engine]/[host]/[context].xml. In your case this would be
$CATALINA_BASE/conf/Catalina/localhost/pr.xml.


For more information you can consult the following two links:

<http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Supported Manager
Commands>
<http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Deploy A New
Application Remotely>
<http://tomcat.apache.org/tomcat-6.0-doc/manager-howto.html#Deploy A New
Application from a Local Path>
<http://mail-archives.apache.org/mod_mbox/tomcat-users/200312.mbox/%3C3FDE1EBB.5010002@yahoo.com%3E>


If you lock in the execute methode of the AntDeploy Task your observations
become really obvious:

// line 182
if ((war == null) && (config != null)) {
    sb.append("&config=");
    sb.append(URLEncoder.encode(config, getCharset()));
}
if ((war == null) && (localWar != null)) {
    sb.append("&war=");
    sb.append(URLEncoder.encode(localWar, getCharset()));
}
// to 189


-- 
Kind Regards
Uwe Günther

-- 
Configure bugmail: https://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org