You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Michael Schuerig <mi...@schuerig.de> on 2004/09/02 21:56:36 UTC

Tomcat 5.5: installing outside webapps via Ant task doesn't seem to work

With the change from Tomcat 5.0.27 to 5.5 the behavior of installing an 
app outside of $CATALINA_HOME/webapps using the Ant deploy task doesn't 
seem to work. Well, at least not for me.

Tomcat 5.0.27 just created a context configuration file in 
$CATALINA_HOME/conf/Catalina/localhost, pointing to my build directory, 
~/workspace/tomtest/build

In contrast, Tomcat 5.5 copies the contents of ~/workspace/tomtest/build 
to $CATALINE_HOME/webapps/tomtest and no context configuration file is 
created in $CATALINA_HOME/conf/Catalina/localhost.

I'm still pretty new to servlets, JSP, and Tomcat, so I might be 
overlooking something rather obvious.

Michael


---->---->---->----
  <property name="app.path"      location="/${app.name}"/>
  <property name="build.home"    location="${basedir}/build"/>

  <target name="tomcat.install" depends="compile"
   description="Install application to servlet container">
    <deploy url="${manager.url}"
     username="${manager.username}"
     password="${manager.password}"
     path="${app.path}"
     localWar="file://${build.home}"/>
  </target>
---->---->---->----

-- 
Michael Schuerig                  Failures to use one's frontal lobes
mailto:michael@schuerig.de        can result in the loss of them.
http://www.schuerig.de/michael/   --William H. Calvin

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat 5.5: installing outside webapps via Ant task doesn't seem to work

Posted by Remy Maucherat <re...@gmail.com>.
On Fri, 3 Sep 2004 00:06:46 +0200, Michael Schuerig <mi...@schuerig.de> wrote:
> On Thursday 02 September 2004 23:41, Remy Maucherat wrote:
> > On Thu, 2 Sep 2004 23:27:59 +0200, Michael Schuerig
> <mi...@schuerig.de> wrote:
> 
> > >   <target name="tomcat.install" depends="compile"
> > >    description="Install application to servlet container">
> > >     <deploy url="${manager.url}"
> > >      username="${manager.username}"
> > >      password="${manager.password}"
> > >      path="/${app.name}"
> > >      config="file://${etc}/context-local.xml" />
> > >   </target>
> > >
> > > It doesn't work, though, as one of war, localWar, or tag is
> > > required. When I give a localWar, it is copied to
> > > $CATALINE_HOME/webapps, but not really used (and not needed) as the
> > > docBase entry in the context config file points somewhere else.
> >
> > It seems there's an annoying test left somewhere. Maybe in the Ant
> > task itself, or it could also be a leftover check in the manager
> > servlet.
> 
> Yes, there's a check in
> 
> jakarta-tomcat-5.5.0-src/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/DeployTask.java
> lines 145-149
> 
>         if ((war == null) && (localWar == null) && (tag == null)) {
>             throw new BuildException
>                 ("Must specify either 'war', 'localWar', or 'tag'
> attribute");
>         }

Thanks.

> The manager servlet itself works with a context config file and a
> context path (not optional in this case!).

I'm surprised the manager servlet works as is: I changed an apparently
bad check:
        } else if (command.equals("/deploy")) {
            if (war != null) {
                deploy(writer, config, path, war, update);
            } else {
                deploy(writer, path, tag);
            }

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat 5.5: installing outside webapps via Ant task doesn't seem to work

Posted by Michael Schuerig <mi...@schuerig.de>.
On Thursday 02 September 2004 23:41, Remy Maucherat wrote:
> On Thu, 2 Sep 2004 23:27:59 +0200, Michael Schuerig 
<mi...@schuerig.de> wrote:

> >   <target name="tomcat.install" depends="compile"
> >    description="Install application to servlet container">
> >     <deploy url="${manager.url}"
> >      username="${manager.username}"
> >      password="${manager.password}"
> >      path="/${app.name}"
> >      config="file://${etc}/context-local.xml" />
> >   </target>
> >
> > It doesn't work, though, as one of war, localWar, or tag is
> > required. When I give a localWar, it is copied to
> > $CATALINE_HOME/webapps, but not really used (and not needed) as the
> > docBase entry in the context config file points somewhere else.
>
> It seems there's an annoying test left somewhere. Maybe in the Ant
> task itself, or it could also be a leftover check in the manager
> servlet.

Yes, there's a check in 

jakarta-tomcat-5.5.0-src/jakarta-tomcat-catalina/catalina/src/share/org/apache/catalina/ant/DeployTask.java
lines 145-149

        if ((war == null) && (localWar == null) && (tag == null)) {
            throw new BuildException
                ("Must specify either 'war', 'localWar', or 'tag' 
attribute");
        }

The manager servlet itself works with a context config file and a 
context path (not optional in this case!).

Michael

-- 
Michael Schuerig                           The more it stays the same,
mailto:michael@schuerig.de                        The less it changes!
http://www.schuerig.de/michael/      --Spinal Tap, The Majesty of Rock

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat 5.5: installing outside webapps via Ant task doesn't seem to work

Posted by Remy Maucherat <re...@gmail.com>.
On Thu, 2 Sep 2004 23:27:59 +0200, Michael Schuerig <mi...@schuerig.de> wrote:
> On Thursday 02 September 2004 22:43, Remy Maucherat wrote:
> > On Thu, 2 Sep 2004 21:56:36 +0200, Michael Schuerig
> <mi...@schuerig.de> wrote:
> [Ant deploy task copies webapps]
> 
> > Yes, this particular case will work like that now, in order to
> > simplify quite a bit the deployer (generating a trivial xml file to
> > reference the context would work, but might not contain what you
> > expect, which is why Tomcat copies your webappp). For now, I
> > recommend giving a xml file to Tomcat if you want to point to an
> > external context.
> 
> Just to make sure I understand you correctly. You mean I create a
> context file like this
> 
> <?xml version='1.0' encoding='utf-8'?>
> <Context path="/stundenplan"
> docBase="/home/michael/workspace/tomtest/build">
> </Context>
> 
> copy it to $CATALINA_HOME/conf/Catalina/localhost/tomtest.xml and wait
> for Tomcat to pick it up?

That works. Don't use the path attribute, Tomcat will get it from the
xml file name.

> Or do you mean an Ant target like this?
> 
>   <target name="tomcat.install" depends="compile"
>    description="Install application to servlet container">
>     <deploy url="${manager.url}"
>      username="${manager.username}"
>      password="${manager.password}"
>      path="/${app.name}"
>      config="file://${etc}/context-local.xml" />
>   </target>
> 
> It doesn't work, though, as one of war, localWar, or tag is required.
> When I give a localWar, it is copied to $CATALINE_HOME/webapps, but not
> really used (and not needed) as the docBase entry in the context config
> file points somewhere else.

It seems there's an annoying test left somewhere. Maybe in the Ant
task itself, or it could also be a leftover check in the manager
servlet.

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat 5.5: installing outside webapps via Ant task doesn't seem to work

Posted by Michael Schuerig <mi...@schuerig.de>.
On Thursday 02 September 2004 22:43, Remy Maucherat wrote:
> On Thu, 2 Sep 2004 21:56:36 +0200, Michael Schuerig 
<mi...@schuerig.de> wrote:
[Ant deploy task copies webapps]

> Yes, this particular case will work like that now, in order to
> simplify quite a bit the deployer (generating a trivial xml file to
> reference the context would work, but might not contain what you
> expect, which is why Tomcat copies your webappp). For now, I
> recommend giving a xml file to Tomcat if you want to point to an
> external context.

Just to make sure I understand you correctly. You mean I create a 
context file like this

<?xml version='1.0' encoding='utf-8'?>
<Context path="/stundenplan" 
docBase="/home/michael/workspace/tomtest/build">
</Context>

copy it to $CATALINA_HOME/conf/Catalina/localhost/tomtest.xml and wait 
for Tomcat to pick it up?

Or do you mean an Ant target like this?

  <target name="tomcat.install" depends="compile"
   description="Install application to servlet container">
    <deploy url="${manager.url}"
     username="${manager.username}"
     password="${manager.password}"
     path="/${app.name}"
     config="file://${etc}/context-local.xml" />
  </target>

It doesn't work, though, as one of war, localWar, or tag is required. 
When I give a localWar, it is copied to $CATALINE_HOME/webapps, but not 
really used (and not needed) as the docBase entry in the context config 
file points somewhere else.

Michael

-- 
Michael Schuerig                  Failures to use one's frontal lobes
mailto:michael@schuerig.de        can result in the loss of them.
http://www.schuerig.de/michael/   --William H. Calvin

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: Tomcat 5.5: installing outside webapps via Ant task doesn't seem to work

Posted by Remy Maucherat <re...@gmail.com>.
On Thu, 2 Sep 2004 21:56:36 +0200, Michael Schuerig <mi...@schuerig.de> wrote:
> 
> With the change from Tomcat 5.0.27 to 5.5 the behavior of installing an
> app outside of $CATALINA_HOME/webapps using the Ant deploy task doesn't
> seem to work. Well, at least not for me.
> 
> Tomcat 5.0.27 just created a context configuration file in
> $CATALINA_HOME/conf/Catalina/localhost, pointing to my build directory,
> ~/workspace/tomtest/build
> 
> In contrast, Tomcat 5.5 copies the contents of ~/workspace/tomtest/build
> to $CATALINE_HOME/webapps/tomtest and no context configuration file is
> created in $CATALINA_HOME/conf/Catalina/localhost.
> 
> I'm still pretty new to servlets, JSP, and Tomcat, so I might be
> overlooking something rather obvious.

Yes, this particular case will work like that now, in order to
simplify quite a bit the deployer (generating a trivial xml file to
reference the context would work, but might not contain what you
expect, which is why Tomcat copies your webappp). For now, I recommend
giving a xml file to Tomcat if you want to point to an external
context.

-- 
xxxxxxxxxxxxxxxxxxxxxxxxx
Rémy Maucherat
Developer & Consultant
JBoss Group (Europe) SàRL
xxxxxxxxxxxxxxxxxxxxxxxxx

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org