At 11:41 AM 3/29/2003 +0100, you wrote:
p.s. I also have found that
"ant deploy"
will give me the context as desired (if stored in META-INF/context.xml as
recommended by you)

Yes, ant's "deploy" task uses HTTP PUT which isn't supported by normal browsers so "deploy" actually can't be done any other way than with the ant manager deploy task (or another custom implementation that enables the use of HTTP PUT). The concept of the META-INF/context.xml was specifically made for this task.


however, "ant install" does not create the same result.
There the context.getInitParameter() and JNDI-configuration
(ResourceLinks) both return null and are not inited correctly.

the "install" task is meant to deploy a directory in any given location, not a .war file. You can provide it a context configuration file (doesn't have to be named "context.xml" is this case, any arbitrary name is fine). Note that getServletContext().getRealPath("/") will return an actual directory path instead of null in this case because the app is being deployed from a directory. And be sure to note that the "install" task is not persistent across Tomcat restarts where the "deploy" task is. This is because the "install" task installs your app into memory and store any information permanently about how to restart the app upon Tomcat restart. This makes it very convenient for development. However, the "deploy" task physically modifies your server.xml to store the information you put in your META-INF/context.xml which allows Tomcat to restart the app upon server restart. This makes it better for production.


Thus it seems that "ant deploy" will correctly initialize the Context, but
"ant install" fails to do so.

It does if it is used correctly.


Working this way, "ant install" seems to be quite useless to me, or does
it have another sense to use it?

thx alot
Johannes



Jake






Jacob Kjome <[EMAIL PROTECTED]>
28.03.2003 20:27
Please respond to
"Tomcat Users List" <[EMAIL PROTECTED]>


To "Tomcat Users List" <[EMAIL PROTECTED]> cc

Subject
Re: Living without a Context - deploying an application using  manager app







What do you mean "Living without a Context"?

Do you mean "living without a Tomcat <Context ...> entry"?

All you have to do is add META-INF/context.xml (the name "context.xml" is
important so don't name it something else) to your .war file.  context.xml

is the context configuration file for the context and contains a single
<Context ...> element and any nested elements that the <Context ...>
element supports.

A sample context.xml might look like...

<Context path="/arbitraypath" docBase="dbadmin.war"/>

Note that the "path" can be anything you want, but the docBase must be the

name of the .war file.

I also saw your other message where you said....

<quote>
additionaly, an application deployed using the manager app currently
returns null if you use servletcontext.getRealPath();
so it's context seems to be quite obfuscated...
</quote>

This is to be expected. When you deploy your app as a .war file and not a

directory structure, you have no file system access.  If you are counting
of having File IO access to within your webapp, you are creating a
non-portable application.  The servlet spec does not guarantee any direct
file system access to any resource on the server other than the directory
path returned by context.getAttribute("javax.servlet.context.tempdir").

there you go.

Jake

At 07:46 PM 3/28/2003 +0100, you wrote:
>hi there,
>
>here are my findings after some experimentation with the ant deploy task
>of the manager app.
>
>*) a complete application can be easily built into a WAR file using ant
>*) this WAR file can be easily deployed using ant deploy task
>*) once deployed onto the server, the application is running with the
>docbase located somewhere under the manager directory:
>ant list
>-> produces:
>"/dbadmin:running:1:F:\tomcat-4.1.18\work\Standalone\localhost\manager\db admin.war"
>
>*) there the application is living
>- without a context
>- thus, also without any JNDI resources etc. defined in server.xml for a
>context dbadmin with docbase dbadmin.
>
>Would renaming the docbase to "
>F:\tomcat-4.1.18\work\Standalone\localhost\manager\dbadmin.war" resolve
>the problem of not having any context?
>What else could be done to get a context for the webapplication
"dbadmin"?
>
>thx
>Johannes

Reply via email to