Rebirth of T-rex

Does dinosaur really extinct? What caused the dinosaur to vanish? Have you ever wonder whether the real 'you' is disappearing and slowly vanishing? Hope that through this blog, we will be able to maintain the real self.

Migrating from Tomcat 5.0.28 to Tomcat 5.5.4

Posted by T-rex Lim Huat Heng

I was working on a project last week in which the application was initially deployed in Tomcat 5.0.28 in my local PC. As I would like to evaluate how JDK 5.0 perform in my local PC, I tried my luck in migrating the application to Tomcat 5.5.4, which is intended for supporting JDK 5.0.

The migration was quite a straight forward process as I just need to change the path for JAVA_HOME (pointing to where JDK 5.0 is installed, eg. c:\j2sdk1.5.0_01) and CATALINA_HOME (where the Tomcat 5.5.4 is installed, eg. c:\jakarta-tomcat-5.5.4) in my system's environment variables; then add the context configuration file in CATALINA_HOME\conf\Catalina\localhost folder, in particularly myapp.xml.

The issue that I faced when the migration was performed was on the content of myapp.xml. I had the following the old myapp.xml:

<Context privileged="true" debug="0" path="/myapp" docBase="c:\software\IDE\eclipse-3.0.1\workspace\myapp">

<Resource name="jdbc/myappdb" type="javax.sql.DataSource" auth="Container">
<ResourceParams name="jdbc/myappdb">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@localhost:1521:dev</value>
</parameter>
<parameter>
<name>username</name>
<value>myappusrid</value>
</parameter>
<parameter>
<name>password</name>
<value>myapppwd</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>10</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
</Context>


However, after simplifying the above to the following, it was running well!
<Context privileged="true" debug="0" path="/myapp" docBase="c:\software\IDE\eclipse-3.0.1\workspace\myapp">

<Resource name="jdbc/myappdb" url="jdbc:oracle:thin:@localhost:1521:dev" username="myappusrid" password="myapppwd" type="javax.sql.DataSource" auth="Container" driverclassname="oracle.jdbc.driver.OracleDriver" maxactive="20" maxidle="10" maxwait="-1">
</Context>


Enjoy and good luck!

2 comments:

Amadeus B.V 勇瑜 said...

wah, it really simplifies da original one alot... dunnit to type so many irritating codes di...

T-rex Lim Huat Heng said...

I guess it's just a matter of making the generalized element into some specific attributes. I agree that it reduces the number of lines, however, usually you only need to write this once when deploying the application, so I would say, not too much of different :)