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?
 
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
 
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
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.