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\dbadmin.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