Manually editing META-INF/context.xml after deploying the .war file in Tomcat is not working

We have three setup one for development, and another for testing and the third one for production. We have different MySQL database servers for each setup. Once the development team releases the builld including a war file with MD5 checksum, the testing team takes the respective build and pick up the war file and deploy in their test server running Tomcat. The database username and password is different for each setup (i.e dev, test and production).

We are using database connection pooling in our webapp and the QA needs to configure the META-INF/context.xml with the MySQL credentials. They use Tomcat manager to deploy the app and then they perform a FTP to the server and edit the context.xml.

The above approach is not working, as a workaround, the QA imports the war file in Eclipse and then edit the context.xml in Eclipse and then export the war file and then redeploy it in Tomcat (i.e in Test server)

We are using a custom MVC framework using JSP and Servlets.

The context.xml file is pasted here for convenience

<?xml version="1.0" encoding="UTF-8"?>
<Context path="/SSG">
<!-- the ssg database that contains admin username and password and database connection pooling -->
<Resource
      name="jdbc/ssg"
      auth="Container"
      type="javax.sql.DataSource"
      factory="org.apache.tomcat.jdbc.pool.DataSourceFactory"
      initialSize="15"
      maxActive="250"
      maxIdle="120"
      minIdle="60"
      timeBetweenEvictionRunsMillis="34000"
      minEvictableIdleTimeMillis="55000"
      validationQuery="SELECT 1"
      validationInterval="34000"
      testOnBorrow="true"
      removeAbandoned="true"
      removeAbandonedTimeout="55"
      username="ssg"
      password="EvMUijh7g8i56uWVFQNGBVE"
      driverClassName="com.mysql.jdbc.Driver"
      url="jdbc:mysql://example.com:3306/ssg?allowMultiQueries=true"
/>
</Context>

Is there any way to edit the context.xml manually using FTP so that the QA can pick up the war file and then directly deploy it in Tomcat instead of reexporting the war file in Eclipse and then make necessary changes in context.xml?
ShajiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
If you need "per instance" configuration like that, can you move it out of the web app's context.xml and into Tomcat's main "conf" directory context.xml?

Otherwise, your method should probably work too though. Are you restarting just the application after you make the changes to context.xml, or are you restarting the whole Tomcat container? It may need a full restart to pick up the changes.
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ShajiAuthor Commented:
mccarl, your solution works in developers machines running Tomcat on Windows, but not in test and production servers running on Linux box. However, your solution helped us to isolate the problem and provided us with an insight.

Thanks mccarl.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Java EE

From novice to tech pro — start learning today.