?
Solved

Application settings per server for tomcat

Posted on 2009-05-10
4
Medium Priority
?
367 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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 500 total points
ID: 24360308
you would create a separate context.xml for testing and production

0

Featured Post

Moving data to the cloud? Find out if you’re ready

Before moving to the cloud, it is important to carefully define your db needs, plan for the migration & understand prod. environment. This wp explains how to define what you need from a cloud provider, plan for the migration & what putting a cloud solution into practice entails.

Question has a verified solution.

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

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.…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

719 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