File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Tomcat and the fly likes Context in server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Context in server" Watch "Context in server" New topic

Context in server

Ralf Wiebicke

Joined: Nov 15, 2008
Posts: 1
Hi all!

Since a while I'm trying to convice the Tomcat to do, what I want to do, but I don't manage it. May be you can help.

I want to have a context.xml for my web application. This context should reside in the server itself, not in the web application. Because: I want to define <Parameter>'s which depend on the server. For instance the mail server should be configured here. On the production server there should be a different mail server than on the test server. And I want to deploy the same war-file on both production and test, and each should use it's mail server. Therefore META-INF/context.xml is not an option.

Then I'll try to use conf/Catalina/localhost/myapp.xml. When I start up the server everything is fine. My webapp can see the <Parameter>'s. But when I upload a new war-file of my application using Lambda Probe, the file myapp.xml is deleted! And of course the application does not find its parameters.

If I try to upload the new war-file with the tomcat manager, I have to undeploy the old application first. If I do this, my myapp.xml is gone as well.

When I put the Context element into the server.xml, I cannot upload any war-file, because the application exists already - even if I tag "Update application, if already exists" in Lambda Probe.

Up to now, I do workaround by putting my <Parameter>'s into conf/context.xml. Then my <Parameter>'s are available in other web apps as well. This is not nice, but not a show stopper. But I want to define a <Manager pathname="/some/absolute/path"> as well. And then this is applied to all webapps, which means they overwrite each others session file when stopping the server.

I think, that what I want is not that exotic. So I think, there must be a solution. Probably I'm doing something completely wrong, but what?

Can anyone help me?

Best regards,
I agree. Here's the link:
subject: Context in server
It's not a secret anymore!