Link to home
Start Free TrialLog in
Avatar of Shaji
Shaji

asked on

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?
ASKER CERTIFIED SOLUTION
Avatar of mccarl
mccarl
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Shaji
Shaji

ASKER

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.