You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jacob Kjome <ho...@visi.com> on 2003/04/30 06:51:16 UTC

Re: manager webapp + ant == missing files (was: Apps Deploying to wrong dir?)

It seems you are counting on Tomcat specific behavior.  There is nothing in 
the servlet spec that says that the container should extract the .war file 
and deploy from a directory.  Deploying directly from a .war file is 
perfectly valid.  Hence, you should not count on File IO access to the 
contents of your webapp.  Load config file using 
context.getResourceAsStream() or use the classloader to load resources as a 
stream.  This will work both within archives and within directories.

BTW, having an appBase doesn't preclude deploying contexts outside that 
appbase to that virtual host.  It just means that that is the default place 
to look for contexts.  It is, in fact, a convenience, not a requirement.

Everything Tomcat is doing is perfectly fine.  You need to fix your webapp 
to be portable as per the servlet spec.

Jake

At 04:16 PM 4/29/2003 -0700, you wrote:
>On Tue, Apr 29, 2003 at 10:17:03PM +0200, johannes.fiala@fwd.at wrote:
> > Hi Mike,
>
>     Hi, thanks for responding.  I have a few questions based on below- 
> hopefully someone can answer them.
>
> > 1.) Deploying using the manager app always results in the WAR file showing
> > up beneath
> > ${CATALINA_BASE}/work/Standalone/localhost/manager/myapp:war
>
>     Why is this?  The document 
> (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/manager-howto.html#Deploy%20A%20New%20Application) 
> plainly states that deploy should:
>         "Upload the web application archive (WAR) file that is specified as
>          the request data in htis HTTP PUT request, install it into the
>          appBase directory of our corresponding virtual host, and start 
> it on
>          the context path specified by the path request parameter."
>
>     I have my appbase set as 'webapps' in my Host definition in 
> server.xml.  Is this just a bug in the documentation, or am I 
> misunderstanding something somewhere?
>
>     In truth, I could deal with this inconsistency easily enough.  The 
> larger problem I'm running into is that I have a properties file called 
> 'velocity.properties' in my .war in the WEB-INF subdirectory, and for 
> some reason when I use either deploy (to actually push the War over the 
> network) or intsall (to just install the War that is already on the 
> server) it doesn't seem to expand that, and pretty much -all- the other 
> files that go in WEB-INF, except for the classes and lib 
> directory.  Needless to say, this causes problems for my code, and makes 
> the manager application almost useless for me.
>
>     Is anyone else running into this issue?
>
>--
>      ________________________________________________________________________
>                 Mike Barrett | "I used to read, now I go to raves."
>              mike@daboyz.org | -- Random MUNI Rider, speaking
>               www.daboyz.org |    to my friend Allison.
>      ------------------------+-----------------------------------------------
>
>---------------------------------------------------------------------
>To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
>For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

Re: manager webapp + ant == missing files (was: Apps Deploying to wrong dir?)

Posted by jo...@fwd.at.
Hi Mike,

There is not just one possible location for your WAR files (i.e. the 
/webapps directory), but there are more of them.
Maybe this is causing the misunderstanding - the identifier "appbase 
directory" relates to how you can access the application, not where it is 
actually stored.

/webapps/ would usually contain the application if you deploy it there 
manually using FTP or if you push up a WAR file which gets extracted then.
However, every application is stored by Tomcat internally as well, inside 
the /work directory. 

To create applications which are be truly portable, you have to access any 
files inside the WAR file (e.g. properties files) using myclass
.getResourceAsStream(), not using FileInputStream etc. 

If you upload a file using the manager application it stores the WAR 
beneath the manager app work directory path. Tomcat is notified of this 
"unusual" location using the docbase attribute of the Context tag:
<Context .. 
docBase="F:\tomcat-4.1.24\work\Standalone\localhost\manager\myapp.war" 
...>

I hope this helps,
Johannes





Michael Barrett <mi...@daboyz.org> 
01.05.2003 00:19
Please respond to
"Tomcat Users List" <to...@jakarta.apache.org>


To
Tomcat Users List <to...@jakarta.apache.org>
cc

Subject
Re: manager webapp + ant == missing files (was: Apps Deploying to wrong 
dir?)






So what is telling the application to deploy it someplace else other than 
the appbase directory?  The manager documentation says it should deploy 
into the appbase directory, so I assumed that it would work as documented. 
 I'm not following why this isn't the case.

Maybe this is just due to my limited understanding of java/servlets.  ANy 
help you can give would be great, thanks.

On Tue, Apr 29, 2003 at 11:51:16PM -0500, Jacob Kjome wrote:
> 
> It seems you are counting on Tomcat specific behavior.  There is nothing 
in 
> the servlet spec that says that the container should extract the .war 
file 
> and deploy from a directory.  Deploying directly from a .war file is 
> perfectly valid.  Hence, you should not count on File IO access to the 
> contents of your webapp.  Load config file using 
> context.getResourceAsStream() or use the classloader to load resources 
as a 
> stream.  This will work both within archives and within directories.
> 
> BTW, having an appBase doesn't preclude deploying contexts outside that 
> appbase to that virtual host.  It just means that that is the default 
place 
> to look for contexts.  It is, in fact, a convenience, not a requirement.
> 
> Everything Tomcat is doing is perfectly fine.  You need to fix your 
webapp 
> to be portable as per the servlet spec.
> 
> Jake
> 
> At 04:16 PM 4/29/2003 -0700, you wrote:
> >On Tue, Apr 29, 2003 at 10:17:03PM +0200, johannes.fiala@fwd.at wrote:
> >> Hi Mike,
> >
> >    Hi, thanks for responding.  I have a few questions based on below- 
> >hopefully someone can answer them.
> >
> >> 1.) Deploying using the manager app always results in the WAR file 
> >showing
> >> up beneath
> >> ${CATALINA_BASE}/work/Standalone/localhost/manager/myapp:war
> >
> >    Why is this?  The document 
> >(
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/manager-howto.html#Deploy%20A%20New%20Application
) 
> >plainly states that deploy should:
> >        "Upload the web application archive (WAR) file that is 
specified as
> >         the request data in htis HTTP PUT request, install it into the
> >         appBase directory of our corresponding virtual host, and start 

> >it on
> >         the context path specified by the path request parameter."
> >
> >    I have my appbase set as 'webapps' in my Host definition in 
> >server.xml.  Is this just a bug in the documentation, or am I 
> >misunderstanding something somewhere?
> >
> >    In truth, I could deal with this inconsistency easily enough.  The 
> >larger problem I'm running into is that I have a properties file called 

> >'velocity.properties' in my .war in the WEB-INF subdirectory, and for 
> >some reason when I use either deploy (to actually push the War over the 

> >network) or intsall (to just install the War that is already on the 
> >server) it doesn't seem to expand that, and pretty much -all- the other 

> >files that go in WEB-INF, except for the classes and lib 
> >directory.  Needless to say, this causes problems for my code, and 
makes 
> >the manager application almost useless for me.
> >
> >    Is anyone else running into this issue?
> >
> >--
> > 
________________________________________________________________________
> >                Mike Barrett | "I used to read, now I go to raves."
> >             mike@daboyz.org | -- Random MUNI Rider, speaking
> >              www.daboyz.org |    to my friend Allison.
> > 
------------------------+-----------------------------------------------
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

-- 
 ________________________________________________________________________
                Mike Barrett | "I used to read, now I go to raves."
             mike@daboyz.org | -- Random MUNI Rider, speaking
              www.daboyz.org |    to my friend Allison.
 ------------------------+-----------------------------------------------

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



Re: manager webapp + ant == missing files (was: Apps Deploying to wrong dir?)

Posted by Michael Barrett <mi...@daboyz.org>.
So what is telling the application to deploy it someplace else other than the appbase directory?  The manager documentation says it should deploy into the appbase directory, so I assumed that it would work as documented.  I'm not following why this isn't the case.

Maybe this is just due to my limited understanding of java/servlets.  ANy help you can give would be great, thanks.

On Tue, Apr 29, 2003 at 11:51:16PM -0500, Jacob Kjome wrote:
> 
> It seems you are counting on Tomcat specific behavior.  There is nothing in 
> the servlet spec that says that the container should extract the .war file 
> and deploy from a directory.  Deploying directly from a .war file is 
> perfectly valid.  Hence, you should not count on File IO access to the 
> contents of your webapp.  Load config file using 
> context.getResourceAsStream() or use the classloader to load resources as a 
> stream.  This will work both within archives and within directories.
> 
> BTW, having an appBase doesn't preclude deploying contexts outside that 
> appbase to that virtual host.  It just means that that is the default place 
> to look for contexts.  It is, in fact, a convenience, not a requirement.
> 
> Everything Tomcat is doing is perfectly fine.  You need to fix your webapp 
> to be portable as per the servlet spec.
> 
> Jake
> 
> At 04:16 PM 4/29/2003 -0700, you wrote:
> >On Tue, Apr 29, 2003 at 10:17:03PM +0200, johannes.fiala@fwd.at wrote:
> >> Hi Mike,
> >
> >    Hi, thanks for responding.  I have a few questions based on below- 
> >hopefully someone can answer them.
> >
> >> 1.) Deploying using the manager app always results in the WAR file 
> >showing
> >> up beneath
> >> ${CATALINA_BASE}/work/Standalone/localhost/manager/myapp:war
> >
> >    Why is this?  The document 
> >(http://jakarta.apache.org/tomcat/tomcat-4.1-doc/manager-howto.html#Deploy%20A%20New%20Application) 
> >plainly states that deploy should:
> >        "Upload the web application archive (WAR) file that is specified as
> >         the request data in htis HTTP PUT request, install it into the
> >         appBase directory of our corresponding virtual host, and start 
> >it on
> >         the context path specified by the path request parameter."
> >
> >    I have my appbase set as 'webapps' in my Host definition in 
> >server.xml.  Is this just a bug in the documentation, or am I 
> >misunderstanding something somewhere?
> >
> >    In truth, I could deal with this inconsistency easily enough.  The 
> >larger problem I'm running into is that I have a properties file called 
> >'velocity.properties' in my .war in the WEB-INF subdirectory, and for 
> >some reason when I use either deploy (to actually push the War over the 
> >network) or intsall (to just install the War that is already on the 
> >server) it doesn't seem to expand that, and pretty much -all- the other 
> >files that go in WEB-INF, except for the classes and lib 
> >directory.  Needless to say, this causes problems for my code, and makes 
> >the manager application almost useless for me.
> >
> >    Is anyone else running into this issue?
> >
> >--
> >     ________________________________________________________________________
> >                Mike Barrett | "I used to read, now I go to raves."
> >             mike@daboyz.org | -- Random MUNI Rider, speaking
> >              www.daboyz.org |    to my friend Allison.
> >     ------------------------+-----------------------------------------------
> >
> >---------------------------------------------------------------------
> >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org

-- 
     ________________________________________________________________________
                Mike Barrett | "I used to read, now I go to raves."
             mike@daboyz.org | -- Random MUNI Rider, speaking
              www.daboyz.org |    to my friend Allison.
     ------------------------+-----------------------------------------------

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