Just do...

<Context path="/myapp" docBase="/apps.war" appBase="webapps" debug="0" reloadable="true" crossContext="true" privileged="true" />

The just drop the "apps.war" file into CATALINA_HOME/webapps. Now start Tomcat.

The war file will *not* be expanded and the customer doesn't need to expand it. It will run from the .war file. Now, this assumes you aren't using any File IO within the WAR. If not, then you are golden. If so, then this won't work for you.

What I meant by "minus the .war" is:

WAR file name: apps.war
directory name: apps

the directory name is the same name as the WAR file name except without the ".war" part....eg... "minus .war".

Anyway, if you want to deploy your app as a directory structure and not a WAR file *and* you want to define a <Context> entry for it, you simply *have* to tell your customer to expand the "apps.war" file to a directory named "apps". A WAR file is, pretty much, the same as a .zip or .jar file. Your customer can use any archive utility that works with .zip or .jar archives to do the extraction. This shoud all be done with Tomcat stopped first.

If you don't want to have to worry about this, then don't add the <Context> entry. It doesn't look like you are really doing anything special in it anyway, so why add it? Tomcat will create a default entry *and* you get the benefit of auto-expansion just like you want.

Jake

At 11:01 AM 2/19/2003 +0530, you wrote:
I think my problem was not clear. I create a war file and put it in webapps and also i define a context for the directory which i except to be created by the tomcat by extracting the war file. I start my tomcat 4.1.12, it craches saying ..\webapps\apps does not exists or is not readable. I want to know
1) is it possible to put the war file with out extracting it and defining teh context. Use it like "http:\\<name>:8080\apps\Welcome.jsp"
2)If 1 cannot be done how do i use war file.(i dont want to extract it myself and define the context myself) i want to put the war file, define context and use it

-----Original Message-----
From: Peng Tuck Kwok [SMTP:[EMAIL PROTECTED]]
Sent: Wednesday, February 19, 2003 10:05 AM
To: Tomcat Users List
Subject: Re: WAR FILE NOT WORKING

If you have already defined a context in server.xml before a war file is
created, then the directory for that context should exist. Otherwise if
you run tomcat from the command line it will just quit. Try this :
remove the reference to the context called apps from your server.xml and
remove (or move somewhere else) the apps directory under webapps. Place
the war file you want in the webapps directory, start (restart if you
are currently running) tomcat. They war file should deploy itself.

You can test the war file unpacking behaviour by downloading a few
examples on your own.


Nandish A wrote:
> Hi Jake(Hope i can call you this way),
> Thanks for your help, but (as usually) things work if extract myself. If i have to extract it myself then the purpose of the war file is not solved(as far as i am concerned). I would like to give the war file to my customer and the configuration of server.xml file, and i except it should extract and work fine. Jake i did not understand what is minus the ".war".
>
> Thanks and regards
> Nandish
>
> Second, if you configure this in server.xml and then expect a .war of the
> name apps.war to be extracted to a directory of the same name (minus the
> ".war"), you are mistaken. You will need to shut down Tomcat and unpack
> this yourself first. If you didn't configure anything in server.xml, then
> it would be unpacked like you expect. It is all in Tomcat's
> documentation. Don't feel alone on this one, though. A lot of people have
> had this confusion and the behavior is somewhat of a contentious
> issue. However, now that you know it works this way (whether we like it or
> not), you can work around it.
>
> Jake
>
> At 04:13 PM 2/18/2003 +0530, you wrote:
>
>>hi all i am using tomcat 4.1.17 windows 95. i tested my application
>>keeping it in a directory "apps" on desktop and configuring the server.xml
>>file. No when i create the war file of the directory
>>and place it in webapps when i restart my server the apps.war is not
>>getting extracted and teh server crashes. i used
>><Context path="\" docBase="/apps" appBase="webapps" debug="0"
>>reloadable="true" crossContext="true" privileged="true">
>>
>>any help any idea any opinion would be great
>>Regards
>>Nandish
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: [EMAIL PROTECTED]
>>For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>
> ------------------------------------------------------------------------
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to