You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Swaminathan Gurumoorthy <sw...@yahoo.com> on 2003/06/02 21:12:12 UTC
issues with war file deployment
I am using Tomcat 4.1.18 to run my Struts 1.1 app.
I am using a configuartion file appname.xml in the "webapps" folder to deploy the application along with a appname.war file.
Now the "Server Configuration Reference" of Tomcat has thie literature for Automatic application deployment.
"
<----
Any XML file in the directory defined by appBase (Application Base directory) is assumed to contain a Context element (and its associated subelements) for a single web application. The docBase attribute of this <Context> element will typically be the absolute pathname to a web applicationd directory, or the absolute pathname of a web application archive (WAR) file (which will not be expanded).
----->"
True to the reference my war file does not expand. But I am having a problem when using
servlet.getServletContext().getRealPath( "/" ) in one of my startup servlets.
This is returning null and so the app fails to load.
Is there a way to solve this?
Thanks
---------------------------------
Do you Yahoo!?
Free online calendar with sync to Outlook(TM).
Re: issues with war file deployment
Posted by Jacob Kjome <ho...@visi.com>.
Yep, unfortunately, this is the behavior that Tomcat has. If you
explicitly define a <Context> for your app, Tomcat will not automatically
explode your .war file to a directory structure. You will have to do this
manually before start of the server. And, BTW, you should avoid
getRealPath() at all costs. If you are just trying to load resources such
as config file from your app, you are better off loading these as streams
from the classloader. Your app will be significantly more portable if you
do this.
Jake
At 12:12 PM 6/2/2003 -0700, you wrote:
>I am using Tomcat 4.1.18 to run my Struts 1.1 app.
>
>I am using a configuartion file appname.xml in the "webapps" folder to
>deploy the application along with a appname.war file.
>
>Now the "Server Configuration Reference" of Tomcat has thie literature for
>Automatic application deployment.
>"
><----
>
>Any XML file in the directory defined by appBase (Application Base
>directory) is assumed to contain a Context element (and its associated
>subelements) for a single web application. The docBase attribute of this
><Context> element will typically be the absolute pathname to a web
>applicationd directory, or the absolute pathname of a web application
>archive (WAR) file (which will not be expanded).
>
>----->"
>
>True to the reference my war file does not expand. But I am having a
>problem when using
>
>servlet.getServletContext().getRealPath( "/" ) in one of my startup servlets.
>
>This is returning null and so the app fails to load.
>
>Is there a way to solve this?
>
>Thanks
>
>
>
>
>
>
>---------------------------------
>Do you Yahoo!?
>Free online calendar with sync to Outlook(TM).