We help IT Professionals succeed at work.
Get Started

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

Shaji
Shaji asked
on
994 Views
Last Modified: 2015-03-19
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?
Comment
Watch Question
IT Business Systems Analyst / Software Developer
CERTIFIED EXPERT
Top Expert 2015
Commented:
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE