You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by ahnf <in...@yahoo.com> on 2008/02/27 17:41:22 UTC

totally confused! deploy & redeploy the ROOT context via manager app and/or ant

Hi,
I've spent the last day trying to do this with no success and here is what I would like to do:

What I want to be able to do
--------------------------------------------------------------
Have a custom virtual host called "myApp", this host will run one web-application, and that web application should respond at the "/". I would also like to deploy this web-application via the manager interface. From time to time I would like to stop the application , undeploy it and then re-deploy a new war for "myApp". Preferably I would like to be able to define the Context in META-INF rather than on the tomcat server itself. Regardless I can live for now with having to define it locally on the tomcat server. 

Seems pretty straightforward. I've put the following together after reading the docs and getting some help on this list.

Here is what I have setup so far

Custom Directories
-----------------------
TOMCAT_HOME/myAppBase
TOMCAT_HOME/myDocBase/myApp

SERVER.XML
------------------------------
       <Host name="myAppHost" appBase="myAppBase" unpackWARs="true" autoDeploy="true">
                <Context path="/manager" docBase="${catalina.home}/server/webapps/manager"
                         privileged="true" antiResourceLocking="false" antiJARLocking="false">

                  <ResourceLink name="users" global="UserDatabase"
                                type="org.apache.catalina.UserDatabase"/>

                </Context>
        </Host>


TOMCAT_HOME/conf/Catalina/myAppHost/ROOT.xml
-----------------------------------------------------------------------------

<!-- NOTE in addition to the below I have tried a docBase of ${catalina.home}/myDocBase/myApp.war as well with no success-->

<Context docBase="${catalina.home}/myDocBase/myApp"
   debug="0"
   workDir="c:\temp\work"
   reloadable="true" 
   override="true"
   swallowOutput="true"
   crossContext="false" >

</Context>


STARTUP TOMCAT
-------------------------------------------
a) Now, I start up tomcat. Note I have nothing deployed to this server yet. 

b) Secondly I then go to http://myAppHost:8080/manager/html

c) There I see two applications listed: "/" & "/manager" as I would expect. Nothing responds at "/" because I have not deployed yet.

d) I proceed to upload (via manager app) my WAR named "myApp.war" and specify the path "/". Press "deploy".

e) Tomcat proceeds to upload "myApp.war" into "myAppBase" and then expand the war to the following dir structure. "myApp/ROOT/". The new application is now deployed at http://myAppHost:8080/myApp however nothing responds because the web.xml is under myApp/ROOT/WEB-INF/web.xml and not directly under myApp.

f) Wait a second.. everything I have read is that the docBase must NOT live under the appBase, yet tomcat just deployed my application in just this fashion. However the application will not start because Tomcat is looking for myApp/WEB-INF/web.xml, and it does not exist there. It exists where tomcat put it myApp/ROOT/WEB-INF/web.xml. The docBase I defined in my ROOT.xml is ignored or I am doing something wrong. From all my tests so far, I am having trouble following the usage of docBase and its significance.

g) Note I have also attempted specifying my docBase to be ${catalina.home}/myDocBase/myApp.war with no success either.

java.lang.IllegalArgumentException: Invalid or unreadable WAR file : C:\Program Files\Apache Software Foundation\Tomcat 5.5\myDocBase\myApp\myApp.war
    at org.apache.naming.resources.WARDirContext.setDocBase(WARDirContext.java:130)
    at org.apache.catalina.core.StandardContext.resourcesStart(StandardContext.java:3855)

h) Lastly I have also tried deleting the conf/Cataling/myAppHost/ROOT.xml. In this case tomcat starts up, I upload a ROOT.war file, with no META-INF/context.xml. Tomcat deploys this to myAppBase/ROOT/ROOT.  If I upload the war file as "myApp.war", tomcat expands it to myAppBase/myApp and it runs OK, but...not under "/". In either case the specification of a "docBase" seems to have no effect.

j) I have also tried defining all of this directly in server.xml. However tomcat will not allow me to deploy applications to contexts defined in server.xml. The manager interface returns an error.

Any assistance appreciated. I'm pretty confused at this point.












---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: totally confused! deploy & redeploy the ROOT context via manager app and/or ant

Posted by AH NF <in...@yahoo.com>.
hmm, I had those set = True for both, and I was getting that behavior,  
only when I set them both to false does it not seem to create the temp  
directories. maybe something else?


On Feb 27, 2008, at 2:31 PM, Mark Thomas wrote:

> AH NF wrote:
>> Hi all,
>> Ok so I have my ROOT.war and "/" host all working as I would like.
>> I startup tomcat with no application defined, and go to /manager. I
>> upload my ROOT.war file,tomcat places it in myAppBase/ROOT as  
>> expected. The application boots
>> up OK.
>> My only problem is that Tomcat appears to actually be booting my
>> application from TOMCAT_HOME/temp/0-ROOT rather than myAppBase/ 
>> ROOT, I can tell because
>> my application reports to a log file the real path of the document  
>> root.
>> Why is it doing this and how can I get tomcat to ensure it is running
>> my app out of myAppBase/ROOT and not TOMCAT_HOME/temp/0-ROOT?
>
> Side-effect of antiResourceLocking="false" antiJARLocking="false"
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: totally confused! deploy & redeploy the ROOT context via manager app and/or ant

Posted by AH NF <in...@yahoo.com>.
Ok, so it seems that if I have both of those settings = "false", I  
don't get the 0-ROOT stuff created in /temp, however on application  
stop and undeploy I have lingering jars leftover and a new deploy will  
not unpack because the ROOT dir already exists


On Feb 27, 2008, at 2:31 PM, Mark Thomas wrote:

> AH NF wrote:
>> Hi all,
>> Ok so I have my ROOT.war and "/" host all working as I would like.
>> I startup tomcat with no application defined, and go to /manager. I
>> upload my ROOT.war file,tomcat places it in myAppBase/ROOT as  
>> expected. The application boots
>> up OK.
>> My only problem is that Tomcat appears to actually be booting my
>> application from TOMCAT_HOME/temp/0-ROOT rather than myAppBase/ 
>> ROOT, I can tell because
>> my application reports to a log file the real path of the document  
>> root.
>> Why is it doing this and how can I get tomcat to ensure it is running
>> my app out of myAppBase/ROOT and not TOMCAT_HOME/temp/0-ROOT?
>
> Side-effect of antiResourceLocking="false" antiJARLocking="false"
>
> Mark
>
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: totally confused! deploy & redeploy the ROOT context via manager app and/or ant

Posted by Mark Thomas <ma...@apache.org>.
AH NF wrote:
> Hi all,
> Ok so I have my ROOT.war and "/" host all working as I would like.
> 
> I startup tomcat with no application defined, and go to /manager. I
> upload my ROOT.war file,tomcat places it in myAppBase/ROOT as expected. 
> The application boots
> up OK.
> 
> My only problem is that Tomcat appears to actually be booting my
> application from TOMCAT_HOME/temp/0-ROOT rather than myAppBase/ROOT, I 
> can tell because
> my application reports to a log file the real path of the document root.
> 
> Why is it doing this and how can I get tomcat to ensure it is running
> my app out of myAppBase/ROOT and not TOMCAT_HOME/temp/0-ROOT?

Side-effect of antiResourceLocking="false" antiJARLocking="false"

Mark


---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: totally confused! deploy & redeploy the ROOT context via manager app and/or ant

Posted by AH NF <in...@yahoo.com>.
Hi all,
Ok so I have my ROOT.war and "/" host all working as I would like.

I startup tomcat with no application defined, and go to /manager. I
upload my ROOT.war file,tomcat places it in myAppBase/ROOT as  
expected. The application boots
up OK.

My only problem is that Tomcat appears to actually be booting my
application from TOMCAT_HOME/temp/0-ROOT rather than myAppBase/ROOT, I  
can tell because
my application reports to a log file the real path of the document root.

Why is it doing this and how can I get tomcat to ensure it is running
my app out of myAppBase/ROOT and not TOMCAT_HOME/temp/0-ROOT?

If I undeploy that application everything is deleted out of myAppBase/  
as expected
but the temp/0-ROOT app still exists. I then re-upload the same WAR  
and it repeats
the process except this time there is a new temp/1-ROOT folder and  
tomcat runs
out of memory and crashes (maybe trying to load 0-ROOT & 1-ROOT)

On Feb 27, 2008, at 10:20 AM, Caldarale, Charles R wrote:

>> From: ahnf [mailto:interz12@yahoo.com]
>> Subject: totally confused! deploy & redeploy the ROOT context
>> via manager app and/or ant
>>
>> Have a custom virtual host called "myApp", this host will run
>> one web-application, and that web application should respond
>> at the "/".
>
> Stop trying to do things the hard way, and just package your default
> webapp in ROOT.war, not under some other name.  You can then put your
> <Context> element (without any path or docBase attributes) in
> META-INF/context.xml inside your ROOT.war file.  Get rid of
> myDocBase/myApp, and let the manager put the ROOT.war file in  
> myAppBase,
> where it belongs.  You'll need to clean out whatever mess has been
> created under myAppBase and under Tomcat's work directory and under
> C:\temp\work.  (Why do you specify a work attribute, by the way?)
>
> I'd also suggest putting the <Context> element for the manager  
> webapp in
> conf/Catalina/myAppHost/manager.xml, rather than in server.xml.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE  
> PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e- 
> mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Re: totally confused! deploy & redeploy the ROOT context via manager app and/or ant

Posted by AH NF <in...@yahoo.com>.
Hi,
Thanks for the reply, I just tried what you suggested.

I cleared out myAppBase

(inside ROOT.war) META-INF/context.xml (removed docBase & path)

VIa the manager I uploaded ROOT.war to myAppHost with the Context Path  
form field set = /

Tomcat extracts ROOT.war in : myAppBase/ROOT/ROOT

The manager shows the "/" and "/manager" application however the "/"  
application just deployed above is not running when i go to http://myAppHost:8080/



On Feb 27, 2008, at 10:20 AM, Caldarale, Charles R wrote:

>> From: ahnf [mailto:interz12@yahoo.com]
>> Subject: totally confused! deploy & redeploy the ROOT context
>> via manager app and/or ant
>>
>> Have a custom virtual host called "myApp", this host will run
>> one web-application, and that web application should respond
>> at the "/".
>
> Stop trying to do things the hard way, and just package your default
> webapp in ROOT.war, not under some other name.  You can then put your
> <Context> element (without any path or docBase attributes) in
> META-INF/context.xml inside your ROOT.war file.  Get rid of
> myDocBase/myApp, and let the manager put the ROOT.war file in  
> myAppBase,
> where it belongs.  You'll need to clean out whatever mess has been
> created under myAppBase and under Tomcat's work directory and under
> C:\temp\work.  (Why do you specify a work attribute, by the way?)
>
> I'd also suggest putting the <Context> element for the manager  
> webapp in
> conf/Catalina/myAppHost/manager.xml, rather than in server.xml.
>
> - Chuck
>
>
> THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE  
> PROPRIETARY
> MATERIAL and is thus for use only by the intended recipient. If you
> received this in error, please contact the sender and delete the e- 
> mail
> and its attachments from all computers.
>
> ---------------------------------------------------------------------
> To start a new topic, e-mail: users@tomcat.apache.org
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>



---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


RE: totally confused! deploy & redeploy the ROOT context via manager app and/or ant

Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: ahnf [mailto:interz12@yahoo.com] 
> Subject: totally confused! deploy & redeploy the ROOT context 
> via manager app and/or ant
> 
> Have a custom virtual host called "myApp", this host will run 
> one web-application, and that web application should respond 
> at the "/".

Stop trying to do things the hard way, and just package your default
webapp in ROOT.war, not under some other name.  You can then put your
<Context> element (without any path or docBase attributes) in
META-INF/context.xml inside your ROOT.war file.  Get rid of
myDocBase/myApp, and let the manager put the ROOT.war file in myAppBase,
where it belongs.  You'll need to clean out whatever mess has been
created under myAppBase and under Tomcat's work directory and under
C:\temp\work.  (Why do you specify a work attribute, by the way?)

I'd also suggest putting the <Context> element for the manager webapp in
conf/Catalina/myAppHost/manager.xml, rather than in server.xml.

 - Chuck


THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY
MATERIAL and is thus for use only by the intended recipient. If you
received this in error, please contact the sender and delete the e-mail
and its attachments from all computers.

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org