Solved

Application settings per server for tomcat

Posted on 2009-05-10
4
358 Views
Last Modified: 2013-12-02
I have two boxes. One for test, one for production.

On test, I may want the following settings:
email=test@test.com
smtp_server=test.int.com
image_uri=/myimgsrvr/testimgages/

On production, I may want the following instead:
email=admin@mycomp.com
smtp_server=mysmtp.mycomp.com
image_uri=/myimgsrvr/prodimages

There are many ways of accomplishing this:
I have used a singleton class with property files.
I have used context.xml and read environment elements.
IF setting is used in servlet, sometimes have used web.xml,

What are the best patterns, system for solving such a problem? Pros/cons?

Note, this is basic web app. No spring,struts,tiles, etc...
0
Comment
Question by:Paullkha
  • 2
4 Comments
 
LVL 86

Expert Comment

by:CEHJ
ID: 24348165
It's just a question of deploying different config files, so it's nothing more or less than a 'macro issue'
0
 
LVL 92

Expert Comment

by:objects
ID: 24350348
handle it in your context.xml, that way your web apps do not need to differ making deployment simpler
0
 
LVL 2

Author Comment

by:Paullkha
ID: 24359765
Since the context.xml config will not change, are there any examples of a wrapper for getting a context?

Should I load all context.xml environment elements into a static variables in a singleton class?

So I could do the following:

MyConfig.SMTP_SERVER
MyConfig.FILE_URI

0
 
LVL 92

Accepted Solution

by:
objects earned 125 total points
ID: 24360308
you would create a separate context.xml for testing and production

0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This exercise is about for the following scenario: Dmgr and One node with 2 application server. Each application server contains it owns application. Application server name as follows server1 contains app1 server2 contains app1 Prereq…
Upgrading Tomcat – There are a couple of methods to upgrade Tomcat is to use The Apache Installer is to download and unzip and run the services.bat remove|install Tomcat6 Because of the App that we are working with, we can only use Tomcat 6.…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…
This video teaches viewers about errors in exception handling.

943 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

4 Experts available now in Live!

Get 1:1 Help Now