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 Barrett <mi...@daboyz.org> on 2003/04/29 01:29:30 UTC

Apps Deploying to wrong dir?

    Hi, my company is planning on using tomcat for one of their applications, and I've been given the task of installing it and setting up the application.

    In doing so I've started to mess around with the manager application and ant to do deployments and just generally control the application.

    I did my first run of the deployment today, and I'm running into an issue.  Instead of the application being deployed into the webapps dir it is being deployed in ${CATALINA_BASE}/work/Standalone/localhost/ .  As well, some of the files in the war (a .properties file that should be in ${CATALINA_BASE}/work/Standalone/localhost/${APP}/WEB-INF) isn't showing up for some reason.  It's in the .war that I'm using for the deployment, so I'm not sure whats going on.

    Any help you can give me on this is much appreciated.  Thanks.

-- 
     ________________________________________________________________________
                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


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

Posted by Jacob Kjome <ho...@visi.com>.
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

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

Posted by Michael Barrett <mi...@daboyz.org>.
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: Apps Deploying to wrong dir?

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

1.) Deploying using the manager app always results in the WAR file showing 
up beneath
${CATALINA_BASE}/work/Standalone/localhost/manager/myapp:war

2.) Parts of the WAR files get extracted to the 
${CATALINA_BASE}/work/Standalone/localhost/myapp
directory, currently it seems 
*) all WEB-INF/lib files
*) all WEB-INF/classes files
*) SESSIONS.ser, which holds the serialized session data after shutdown of 
Tomcat.

3.) I've also messed around with the manager app for awhile and have had 
the following troubles so far:
*) sometimes the InitParameter's of context.xml don't get correctly 
initialized.
This is especially the case if you write a redeploy task with ant, to 
perform undeploy/deploy sequentially. This seems to lead to the error of a 
half-inited Context. Only undeploy, waiting a few seconds and then deploy 
seems to help, but not always.
I've posted this quite a few times at this forum, but it seems I'm alone 
with this bug (occurs in Tomcat 4.1.18 + 4.1.24, Windows 2000 
Professional).

*) recently I've had another strange issue with BouncyCastle.
I get a PKCS12 not inited error, after a redeploy. Only a complete 
stop/start of Tomcat helps.
However, sometimes more than one redeploy is necessary to get this error.

Maybe you will run in these troubles as well and maybe you find a way out.

thx
Johannes




Michael Barrett <mi...@daboyz.org> 
29.04.2003 01:29
Please respond to
"Tomcat Users List" <to...@jakarta.apache.org>


To
tomcat-user@jakarta.apache.org
cc

Subject
Apps Deploying to wrong dir?






    Hi, my company is planning on using tomcat for one of their 
applications, and I've been given the task of installing it and setting up 
the application.

    In doing so I've started to mess around with the manager application 
and ant to do deployments and just generally control the application.

    I did my first run of the deployment today, and I'm running into an 
issue.  Instead of the application being deployed into the webapps dir it 
is being deployed in ${CATALINA_BASE}/work/Standalone/localhost/ .  As 
well, some of the files in the war (a .properties file that should be in 
${CATALINA_BASE}/work/Standalone/localhost/${APP}/WEB-INF) isn't showing 
up for some reason.  It's in the .war that I'm using for the deployment, 
so I'm not sure whats going on.

    Any help you can give me on this is much appreciated.  Thanks.

-- 
 ________________________________________________________________________
                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