I am trying to migrate an in-house app that runs in production on Tomcat 5.0.28 and Java 1.4.2 to Tomcat 6.0.26 and Java 1.6.0_20. Hibernate 2.1b6 came with the app's WAR file and is in …<app>/WEB-INF/lib. The app also contains Struts 1.3.10, Axis 1.4 and a number of other things. The app uses c3p0 but it is not packaged with the app; on the production server it lives at /var/jakarta-tomcat-5.0.28/common/lib/c3p0-0.9.1.2.jar.
My prototype target server is a Gentoo Linux instance and the above Tomcat/Java arrangement is in place and working.
The app runs against a DB2 database; I've got a username, password, server FQDN, port number, and database name to point the app to. I have the proper version of DB2 JDBC driver and associated license files for the DB2 version/fixpack involved; they are symlinked within /usr/share/tomcat-6/lib as db2jcc.jar, db2jcc_license_cisuz.jar, and db2jcc_license_cu.jar.
The app uses c3p0 but it is not packaged with the app; on the production server it lives at /var/jakarta-tomcat-5.0.28/common/lib/c3p0-0.9.1.2.jar. This is the same version that is installed by Gentoo's package manager at the moment but it puts the jar at /usr/share/c3p0/lib/c3p0.jar and performs no further integration; on my prototype target server I've made a symlink from /usr/share/tomcat-6/lib/c3p0.jar to there.
The app's original platform sets up its datasource in /var/jakarta-tomcat-5.0.28/conf/vhosts.xml, which I'll abbreviate/redact as follows:
Code:
<Host name="thisapp.thiscompany.com" appBase="webapps" unpackWARs="true" autoDeploy="true">
<Context debug="0" docBase="${catalina.home}/webapps/thisapp" path="">
<Resource
name="jdbc/POOL"
description="DB connection pool for ELMS"
auth="Container"
type="com.mchange.v2.c3p0.ComboPooledDataSource"
/>
<ResourceParams name="jdbc/POOL">
<parameter>
<name>factory</name>
<value>org.apache.naming.factory.BeanFactory</value>
</parameter>
<parameter>
<name>driverClass</name>
<value>com.ibm.db2.jcc.DB2Driver</value>
</parameter>
<parameter>
<name>jdbcUrl</name>
<value>jdbc:db2://dbserver.thiscompany.com:50000/PROD</value>
</parameter>
.
.
.
<parameter>
<name>maxPoolSize</name>
<value>23</value>
</parameter>
<parameter>
<name>maxStatements</name>
<value>0</value>
</parameter>
.
.
.
</ResourceParams>
</Context>
</Host>
Vhosts.xml appears to be getting invoked as follows near the top of /var/jakarta-tomcat-5.0.28/conf/server.xml:
Code:
<!DOCTYPE web-app[
<!ENTITY vhosts SYSTEM "vhosts.xml">
]>
.
Also on the original platform, hibernate.properties has but one uncommented line:
Code:
elms.config.THISAPP=thisapp/resource/hibernate-THISAPP.xml
.../webapps/thisapp/WEB-INF/classes/thisapp/resource/hibernate-THISAPP.xml (redacted) can be seen at
http://pastebin.com/RJ7QyTJv .
So I've been looking at docs like
http://community.jboss.org/wiki/HowToconfiguretheC3P0connectionpool and
http://community.jboss.org/wiki/UsingHibernatewithTomcat and I'm trying to find the "industrially correct" way to configure this datasource. I can start the app and get to its logon screen, but I get exceptions at logon complaining largely about Hibernate.
My questions:
1. Can someone give me an idea how the datasource config info ought to be spread amongst app-specific files (e.g., web.xml, context.xml), c3p0 config, and Hibernate config?
2. Am I OK going forward with Hibernate 2.1b6 as packaged with the app?
3. Noting line 67 in hibernate-THISAPP.xml (redacted) at
http://pastebin.com/RJ7QyTJv , does the presence of this parameter suggests that Hibernate's connection pooler was made active in addition to c3p0?
4. Regarding custom class described at lines 18-22 in hibernate-THISAPP.xml: why would a custom class be necessary to "taylor [
sic] JDBC connection settings?"
Thanks!