You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Jeff Hubbs <jh...@att.net> on 2010/05/13 21:55:50 UTC
Porting app from Tomcat 5.0.28 to 6.0.26
Hello -
I have a DB2-backed legacy app on a legacy platform that I'm trying to
modernize. My objective is to modernize the platform underneath the app
(Gentoo Linux for now, Tomcat 6.0.26, Sun JDK 1.6.0.20) and do so in a
way that a longtime Java/Tomcat integrator would readily recognize (I'm
not one). App uses Hibernate and c3p0; Hibernate is packaged in the
app's war but c3p0 is not; I've installed c3p0 through Gentoo's usual
package management system. I've also brought in the jar for the proper
version of IBM DB2 JDBC driver and its corresponding "license jar" to
match the DB2 instance version (versioning between DB2 and JDBC driver
are tightly coupled).
On the legacy Tomcat 5.0 / JDK 1.5 platform, the database connection
configuration info is handled in a seemingly customized way - something
to do with virtual hosts. At the top of the Tomcat-instance-wide
server.xml file is this structure:
<!DOCTYPE web-app[
<!ENTITY vhosts SYSTEM "vhosts.xml">
]>
But for now, I'm not interested in dealing with any kind of virtual host
arrangement. The impetus behind that was so that users can run two
independent sessions of the app in two separate browser tabs or windows .
In the vhosts.xml file is info that looks like it ought to belong in the
app's context.xml file. I understand that how context sections are
written have changed since 5.0 and I *think* I've got that worked out.
The app's original MANIFEST.MF file has this in it:
Classpath: WEB-INF/classes/mycapp/resource
WEB-INF/classes/myapp/resource
/tld WEB-INF/classes/elms/resource/hbm/MYAPP
So: given a working platform and after deploying the app war that I've
been given (let's call it "myapp.war"), here are the post-deploy steps
I've worked out so far:
* Create a symlink for $CATALINA_BASE/webapps/myapp/WEB-INF/lib/c3p0.jar
to where the package manager has put c3p0.jar
* Create symlinks for db2jcc.jar and db2jcc_license_cu.jar in
$CATALINA_BASE/webapps/myapp/WEB-INF/lib to where I've put them under
/usr/src
* Generate a new $CATALINA_BASE/webapps/myapp/META-INF/context.xml (see
below) and symlink $CATALINA_BASE/conf/Catalina/localhost/myapp.xml to it
* Add the following to $CATALINA_BASE/webapps/myapp/WEB-INF/web.xml,
before the closing "</web-app>":
<resource-ref>
<description>DB connection pool for MYAPP</description>
<res-ref-name>jdbc/myappqa</res-ref-name>
<res-type>com.mchange.v2.c3p0.ComboPooledDataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
I've created a context.xml that looks like:
<Context docBase="${catalina.home}/webapps/myapp" path=""
reloadable="false">
<Resource name="jdbc/myappqa"
description = "MYAPP connection pool"
auth="Container"
type="com.mchange.v2.c3p0.ComboPooledDataSource"
username="myappuser"
password="myapppassword"
driverClass="com.ibm.db2.jcc.DB2Driver"
url="jdbc:db2://mydb2server:50000/TESTDATA"
factory="org.apache.naming.factory.BeanFactory"
minPoolSize="15"
.
. <scissors of brevity applied - more parameters set>
.
/>
</Context>
I've been able to browse to the app and get a login page, but things
explode at login attempt, i.e., first attempt to access the data source.
Question 1: For this to work, do I need to add "WEB-INF/lib" to the
"Classpath:" list? There are about 80 jar files (including log4j,
ftpbean, Hibernate) in there aside from the symlinks I've added for the
c3p0, JDBC driver, and license jar files.
Question 2: In my context.xml, is that one parameter supposed to be
"driverClass" or "driverClassName"? I've seen both used seemingly for
the same purpose.
Question 3: Some customization has been done involving
hibernate.properties which I don't think is necessarily causing a
problem (its "meat" has been replaced by a reference to another file
much like server.xml), but in there I've noticed this:
<property name="hibernate.connection.pool_size">15</property>
As I understand it, setting this parameter activates Hibernate's own
connection pooler and further that Hibernate's own connection pooler is
not supposed to be used in any capacity other than learning and
testing. Does having this setting be in here mean that this app was
built (intentionally or not - likely not) to use Hibernate's connection
pooler and c3p0 end-to-end?
Thanks in advance for your opinions/assistance.
Re: Porting app from Tomcat 5.0.28 to 6.0.26
Posted by Pid <pi...@pidster.com>.
On 13/05/2010 20:55, Jeff Hubbs wrote:
> Hello -
Please start an entirely new message when posting to the list rather
than editing a reply to another email. This is called thread-hijacking.
p
> I have a DB2-backed legacy app on a legacy platform that I'm trying to
> modernize. My objective is to modernize the platform underneath the app
> (Gentoo Linux for now, Tomcat 6.0.26, Sun JDK 1.6.0.20) and do so in a
> way that a longtime Java/Tomcat integrator would readily recognize (I'm
> not one). App uses Hibernate and c3p0; Hibernate is packaged in the
> app's war but c3p0 is not; I've installed c3p0 through Gentoo's usual
> package management system. I've also brought in the jar for the proper
> version of IBM DB2 JDBC driver and its corresponding "license jar" to
> match the DB2 instance version (versioning between DB2 and JDBC driver
> are tightly coupled).
>
> On the legacy Tomcat 5.0 / JDK 1.5 platform, the database connection
> configuration info is handled in a seemingly customized way - something
> to do with virtual hosts. At the top of the Tomcat-instance-wide
> server.xml file is this structure:
>
> <!DOCTYPE web-app[
> <!ENTITY vhosts SYSTEM "vhosts.xml">
> ]>
>
> But for now, I'm not interested in dealing with any kind of virtual host
> arrangement. The impetus behind that was so that users can run two
> independent sessions of the app in two separate browser tabs or windows .
>
> In the vhosts.xml file is info that looks like it ought to belong in the
> app's context.xml file. I understand that how context sections are
> written have changed since 5.0 and I *think* I've got that worked out.
>
> The app's original MANIFEST.MF file has this in it:
>
> Classpath: WEB-INF/classes/mycapp/resource
> WEB-INF/classes/myapp/resource
> /tld WEB-INF/classes/elms/resource/hbm/MYAPP
>
> So: given a working platform and after deploying the app war that I've
> been given (let's call it "myapp.war"), here are the post-deploy steps
> I've worked out so far:
>
> * Create a symlink for $CATALINA_BASE/webapps/myapp/WEB-INF/lib/c3p0.jar
> to where the package manager has put c3p0.jar
>
> * Create symlinks for db2jcc.jar and db2jcc_license_cu.jar in
> $CATALINA_BASE/webapps/myapp/WEB-INF/lib to where I've put them under
> /usr/src
>
> * Generate a new $CATALINA_BASE/webapps/myapp/META-INF/context.xml (see
> below) and symlink $CATALINA_BASE/conf/Catalina/localhost/myapp.xml to it
>
> * Add the following to $CATALINA_BASE/webapps/myapp/WEB-INF/web.xml,
> before the closing "</web-app>":
>
> <resource-ref>
> <description>DB connection pool for MYAPP</description>
> <res-ref-name>jdbc/myappqa</res-ref-name>
> <res-type>com.mchange.v2.c3p0.ComboPooledDataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> I've created a context.xml that looks like:
>
> <Context docBase="${catalina.home}/webapps/myapp" path=""
> reloadable="false">
> <Resource name="jdbc/myappqa"
> description = "MYAPP connection pool"
> auth="Container"
> type="com.mchange.v2.c3p0.ComboPooledDataSource"
> username="myappuser"
> password="myapppassword"
> driverClass="com.ibm.db2.jcc.DB2Driver"
> url="jdbc:db2://mydb2server:50000/TESTDATA"
> factory="org.apache.naming.factory.BeanFactory"
> minPoolSize="15"
> .
> . <scissors of brevity applied - more parameters set>
> .
> />
> </Context>
>
>
> I've been able to browse to the app and get a login page, but things
> explode at login attempt, i.e., first attempt to access the data source.
>
> Question 1: For this to work, do I need to add "WEB-INF/lib" to the
> "Classpath:" list? There are about 80 jar files (including log4j,
> ftpbean, Hibernate) in there aside from the symlinks I've added for the
> c3p0, JDBC driver, and license jar files.
>
> Question 2: In my context.xml, is that one parameter supposed to be
> "driverClass" or "driverClassName"? I've seen both used seemingly for
> the same purpose.
>
> Question 3: Some customization has been done involving
> hibernate.properties which I don't think is necessarily causing a
> problem (its "meat" has been replaced by a reference to another file
> much like server.xml), but in there I've noticed this:
>
> <property name="hibernate.connection.pool_size">15</property>
>
> As I understand it, setting this parameter activates Hibernate's own
> connection pooler and further that Hibernate's own connection pooler is
> not supposed to be used in any capacity other than learning and
> testing. Does having this setting be in here mean that this app was
> built (intentionally or not - likely not) to use Hibernate's connection
> pooler and c3p0 end-to-end?
>
> Thanks in advance for your opinions/assistance.
>
>
RE: Porting app from Tomcat 5.0.28 to 6.0.26
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jeff Hubbs [mailto:jhubbslist@att.net]
> To: Tomcat Users List
> Subject: Re: Porting app from Tomcat 5.0.28 to 6.0.26
>
> Also, this wiki says " Hibernate ships with the CP30 connection pooling
> classes, so as long as the Hibernate jars are in WEB-INF/lib directory
> (which they should be), they should be available. " Was that also true
> as of Hibernate 2.1b6?
That would be a question for a Hibernate list, not Tomcat's.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Porting app from Tomcat 5.0.28 to 6.0.26
Posted by Jeff Hubbs <jh...@att.net>.
Thanks, Mark - for now I'm trying Tomcat-only pooling (first part of
that aforementioned wiki page) just hoping I can get a datasource
connection...if that works I may go on to the Hib/c3p0 bit.
- Jeff
On 5/14/10 3:19 PM, Mark Eggers wrote:
> I'm not familiar with the earlier versions of Hibernate, so I can't reliably comment.
>
> However, the principles should be the same even if some of the names have changed.
>
> If you are relying on Hibernate for database connections and database pooling, then you'll want to put all of that information into the Hibernate configuration files and none of it in META-INF/context.xml and WEB-INF/web.xml.
>
> Just a quick skim of the documentation at http://simoes.org/docs/hibernate-2.1/reference/html/index.html and a forum message concerning cp30 configuration doesn't reveal any name changes, but your mileage may vary.
>
> Also, according to the migration document found at http://community.jboss.org/wiki/HibernateCoreMigrationGuide30, there are a lot of code changes between Hibernate 2 and Hibernate 3, but apparently no configuration changes.
>
> Hopefully, the c3p0 / Hibernate managed database connection configuration given at the bottom of the Wiki page should work for Hibernate 2.x.
>
> just my two cents . . . .
>
> /mde/
>
> --- On Fri, 5/14/10, Jeff Hubbs<jh...@att.net> wrote:
>
>
>
>> Also, this wiki says " Hibernate
>> ships with the CP30 connection pooling
>> classes, so as long as the Hibernate jars are in
>> WEB-INF/lib directory
>> (which they should be), they should be available. "
>> Was that also true
>> as of Hibernate 2.1b6?
>>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Porting app from Tomcat 5.0.28 to 6.0.26
Posted by Mark Eggers <it...@yahoo.com>.
I'm not familiar with the earlier versions of Hibernate, so I can't reliably comment.
However, the principles should be the same even if some of the names have changed.
If you are relying on Hibernate for database connections and database pooling, then you'll want to put all of that information into the Hibernate configuration files and none of it in META-INF/context.xml and WEB-INF/web.xml.
Just a quick skim of the documentation at http://simoes.org/docs/hibernate-2.1/reference/html/index.html and a forum message concerning cp30 configuration doesn't reveal any name changes, but your mileage may vary.
Also, according to the migration document found at http://community.jboss.org/wiki/HibernateCoreMigrationGuide30, there are a lot of code changes between Hibernate 2 and Hibernate 3, but apparently no configuration changes.
Hopefully, the c3p0 / Hibernate managed database connection configuration given at the bottom of the Wiki page should work for Hibernate 2.x.
just my two cents . . . .
/mde/
--- On Fri, 5/14/10, Jeff Hubbs <jh...@att.net> wrote:
> Also, this wiki says " Hibernate
> ships with the CP30 connection pooling
> classes, so as long as the Hibernate jars are in
> WEB-INF/lib directory
> (which they should be), they should be available. "
> Was that also true
> as of Hibernate 2.1b6?
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Porting app from Tomcat 5.0.28 to 6.0.26
Posted by Jeff Hubbs <jh...@att.net>.
Also, this wiki says " Hibernate ships with the CP30 connection pooling
classes, so as long as the Hibernate jars are in WEB-INF/lib directory
(which they should be), they should be available. " Was that also true
as of Hibernate 2.1b6?
On 5/14/10 9:48 AM, Jeff Hubbs wrote:
> Thanks, Mark - this is useful but it also raises more questions for me...
>
> This page specifically mentions " Tomcat's database connection pool" -
> distinct from Hibernate's and I assume distinct from c3p0. Did Tomcat
> sprout this ability during the years between 5.0.28 and 6.0.26, and if
> so, should I abandon c3p0 entirely?
>
> Another question: this app has Hibernate 2.1b6 packaged in with
> it...should I fly in a newer one as long as the usage won't have
> changed? I'm not really in a position to rework the app to handle
> usage changes.
>
> Thanks,
>
> Jeff
>
> On 5/13/10 5:28 PM, Mark Eggers wrote:
>> Here's a link from the Tomcat Wiki.
>>
>> http://wiki.apache.org/tomcat/TomcatHibernate
>>
>> The bottom portion of the document explains how to use Hibernate to
>> manage database pooling instead of Tomcat.
>>
>> I hope it gives you some leads.
>>
>> . . . . just my two cents
>>
>> /mde
>>
>> --- On Thu, 5/13/10, Jeff Hubbs<jh...@att.net> wrote:
>>
>>> From: Jeff Hubbs<jh...@att.net>
>>> Subject: Porting app from Tomcat 5.0.28 to 6.0.26
>>> To: "Tomcat Users List"<us...@tomcat.apache.org>
>>> Date: Thursday, May 13, 2010, 12:55 PM
>>> Hello -
>>>
>>> I have a DB2-backed legacy app on a legacy platform that
>>> I'm trying to modernize. My objective is to modernize
>>> the platform underneath the app (Gentoo Linux for now,
>>> Tomcat 6.0.26, Sun JDK 1.6.0.20) and do so in a way that a
>>> longtime Java/Tomcat integrator would readily recognize (I'm
>>> not one). App uses Hibernate and c3p0; Hibernate is
>>> packaged in the app's war but c3p0 is not; I've installed
>>> c3p0 through Gentoo's usual package management system. I've also
>>> brought in the jar for the proper version of IBM
>>> DB2 JDBC driver and its corresponding "license jar" to match
>>> the DB2 instance version (versioning between DB2 and JDBC
>>> driver are tightly coupled).
>>>
>>> On the legacy Tomcat 5.0 / JDK 1.5 platform, the database
>>> connection configuration info is handled in a seemingly
>>> customized way - something to do with virtual hosts. At the top of
>>> the Tomcat-instance-wide server.xml file is
>>> this structure:
>>>
>>> <!DOCTYPE web-app[
>>> <!ENTITY vhosts SYSTEM "vhosts.xml">
>>> ]>
>>>
>>> But for now, I'm not interested in dealing with any kind of
>>> virtual host arrangement. The impetus behind that was
>>> so that users can run two independent sessions of the app in
>>> two separate browser tabs or windows .
>>>
>>> In the vhosts.xml file is info that looks like it ought to
>>> belong in the app's context.xml file. I understand
>>> that how context sections are written have changed since 5.0
>>> and I *think* I've got that worked out.
>>>
>>> The app's original MANIFEST.MF file has this in it:
>>>
>>> Classpath:
>>> WEB-INF/classes/mycapp/resource
>>> WEB-INF/classes/myapp/resource
>>> /tld
>>> WEB-INF/classes/elms/resource/hbm/MYAPP
>>>
>>> So: given a working platform and after deploying the
>>> app war that I've been given (let's call it "myapp.war"),
>>> here are the post-deploy steps I've worked out so far:
>>>
>>> * Create a symlink for
>>> $CATALINA_BASE/webapps/myapp/WEB-INF/lib/c3p0.jar to where
>>> the package manager has put c3p0.jar
>>>
>>> * Create symlinks for db2jcc.jar and db2jcc_license_cu.jar
>>> in $CATALINA_BASE/webapps/myapp/WEB-INF/lib to where I've
>>> put them under /usr/src
>>>
>>> * Generate a new
>>> $CATALINA_BASE/webapps/myapp/META-INF/context.xml (see
>>> below) and symlink
>>> $CATALINA_BASE/conf/Catalina/localhost/myapp.xml to it
>>>
>>> * Add the following to
>>> $CATALINA_BASE/webapps/myapp/WEB-INF/web.xml, before the
>>> closing "</web-app>":
>>>
>>> <resource-ref>
>>> <description>DB connection pool for
>>> MYAPP</description>
>>> <res-ref-name>jdbc/myappqa</res-ref-name>
>>> <res-type>com.mchange.v2.c3p0.ComboPooledDataSource</res-type>
>>> <res-auth>Container</res-auth>
>>> </resource-ref>
>>>
>>> I've created a context.xml that looks like:
>>>
>>> <Context
>>> docBase="${catalina.home}/webapps/myapp" path=""
>>> reloadable="false">
>>> <Resource name="jdbc/myappqa"
>>> description =
>>> "MYAPP connection pool"
>>> auth="Container"
>>> type="com.mchange.v2.c3p0.ComboPooledDataSource"
>>> username="myappuser"
>>> password="myapppassword"
>>> driverClass="com.ibm.db2.jcc.DB2Driver"
>>> url="jdbc:db2://mydb2server:50000/TESTDATA"
>>> factory="org.apache.naming.factory.BeanFactory"
>>> minPoolSize="15"
>>> .
>>> .<scissors of
>>> brevity applied - more parameters set>
>>> .
>>> />
>>> </Context>
>>>
>>>
>>> I've been able to browse to the app and get a login page,
>>> but things explode at login attempt, i.e., first attempt to
>>> access the data source.
>>>
>>> Question 1: For this to work, do I need to add
>>> "WEB-INF/lib" to the "Classpath:" list? There are
>>> about 80 jar files (including log4j, ftpbean, Hibernate) in
>>> there aside from the symlinks I've added for the c3p0, JDBC
>>> driver, and license jar files.
>>>
>>> Question 2: In my context.xml, is that one parameter
>>> supposed to be "driverClass" or "driverClassName"? I've seen both
>>> used seemingly for the same purpose.
>>>
>>> Question 3: Some customization has been done
>>> involving hibernate.properties which I don't think is
>>> necessarily causing a problem (its "meat" has been replaced
>>> by a reference to another file much like server.xml), but in
>>> there I've noticed this:
>>>
>>> <property
>>> name="hibernate.connection.pool_size">15</property>
>>>
>>> As I understand it, setting this parameter activates
>>> Hibernate's own connection pooler and further that
>>> Hibernate's own connection pooler is not supposed to be used
>>> in any capacity other than learning and testing. Does
>>> having this setting be in here mean that this app was built
>>> (intentionally or not - likely not) to use Hibernate's
>>> connection pooler and c3p0 end-to-end?
>>>
>>> Thanks in advance for your opinions/assistance.
>>>
>>>
>>
>>
>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
>> For additional commands, e-mail: users-help@tomcat.apache.org
>>
>>
>
>
RE: Porting app from Tomcat 5.0.28 to 6.0.26
Posted by "Caldarale, Charles R" <Ch...@unisys.com>.
> From: Jeff Hubbs [mailto:jhubbslist@att.net]
> Subject: Re: Porting app from Tomcat 5.0.28 to 6.0.26
>
> Did Tomcat sprout this ability during the years between
> 5.0.28 and 6.0.26
No, Tomcat has done DB connection pooling for ages.
> should I abandon c3p0 entirely?
Probably not.
> this app has Hibernate 2.1b6 packaged in with it...should
> I fly in a newer one as long as the usage won't have changed?
You would probably get better support from whoever does that for Hibernate if you use current levels of that product - but that's just a guess, and the question should be asked of Hibernate, not Tomcat.
- Chuck
THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers.
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org
Re: Porting app from Tomcat 5.0.28 to 6.0.26
Posted by Jeff Hubbs <jh...@att.net>.
Thanks, Mark - this is useful but it also raises more questions for me...
This page specifically mentions " Tomcat's database connection pool" -
distinct from Hibernate's and I assume distinct from c3p0. Did Tomcat
sprout this ability during the years between 5.0.28 and 6.0.26, and if
so, should I abandon c3p0 entirely?
Another question: this app has Hibernate 2.1b6 packaged in with
it...should I fly in a newer one as long as the usage won't have
changed? I'm not really in a position to rework the app to handle usage
changes.
Thanks,
Jeff
On 5/13/10 5:28 PM, Mark Eggers wrote:
> Here's a link from the Tomcat Wiki.
>
> http://wiki.apache.org/tomcat/TomcatHibernate
>
> The bottom portion of the document explains how to use Hibernate to manage database pooling instead of Tomcat.
>
> I hope it gives you some leads.
>
> . . . . just my two cents
>
> /mde
>
> --- On Thu, 5/13/10, Jeff Hubbs<jh...@att.net> wrote:
>
>
>> From: Jeff Hubbs<jh...@att.net>
>> Subject: Porting app from Tomcat 5.0.28 to 6.0.26
>> To: "Tomcat Users List"<us...@tomcat.apache.org>
>> Date: Thursday, May 13, 2010, 12:55 PM
>> Hello -
>>
>> I have a DB2-backed legacy app on a legacy platform that
>> I'm trying to modernize. My objective is to modernize
>> the platform underneath the app (Gentoo Linux for now,
>> Tomcat 6.0.26, Sun JDK 1.6.0.20) and do so in a way that a
>> longtime Java/Tomcat integrator would readily recognize (I'm
>> not one). App uses Hibernate and c3p0; Hibernate is
>> packaged in the app's war but c3p0 is not; I've installed
>> c3p0 through Gentoo's usual package management system.
>> I've also brought in the jar for the proper version of IBM
>> DB2 JDBC driver and its corresponding "license jar" to match
>> the DB2 instance version (versioning between DB2 and JDBC
>> driver are tightly coupled).
>>
>> On the legacy Tomcat 5.0 / JDK 1.5 platform, the database
>> connection configuration info is handled in a seemingly
>> customized way - something to do with virtual hosts.
>> At the top of the Tomcat-instance-wide server.xml file is
>> this structure:
>>
>> <!DOCTYPE web-app[
>> <!ENTITY vhosts SYSTEM "vhosts.xml">
>> ]>
>>
>> But for now, I'm not interested in dealing with any kind of
>> virtual host arrangement. The impetus behind that was
>> so that users can run two independent sessions of the app in
>> two separate browser tabs or windows .
>>
>> In the vhosts.xml file is info that looks like it ought to
>> belong in the app's context.xml file. I understand
>> that how context sections are written have changed since 5.0
>> and I *think* I've got that worked out.
>>
>> The app's original MANIFEST.MF file has this in it:
>>
>> Classpath:
>> WEB-INF/classes/mycapp/resource
>> WEB-INF/classes/myapp/resource
>> /tld
>> WEB-INF/classes/elms/resource/hbm/MYAPP
>>
>> So: given a working platform and after deploying the
>> app war that I've been given (let's call it "myapp.war"),
>> here are the post-deploy steps I've worked out so far:
>>
>> * Create a symlink for
>> $CATALINA_BASE/webapps/myapp/WEB-INF/lib/c3p0.jar to where
>> the package manager has put c3p0.jar
>>
>> * Create symlinks for db2jcc.jar and db2jcc_license_cu.jar
>> in $CATALINA_BASE/webapps/myapp/WEB-INF/lib to where I've
>> put them under /usr/src
>>
>> * Generate a new
>> $CATALINA_BASE/webapps/myapp/META-INF/context.xml (see
>> below) and symlink
>> $CATALINA_BASE/conf/Catalina/localhost/myapp.xml to it
>>
>> * Add the following to
>> $CATALINA_BASE/webapps/myapp/WEB-INF/web.xml, before the
>> closing "</web-app>":
>>
>> <resource-ref>
>> <description>DB connection pool for
>> MYAPP</description>
>> <res-ref-name>jdbc/myappqa</res-ref-name>
>> <res-type>com.mchange.v2.c3p0.ComboPooledDataSource</res-type>
>> <res-auth>Container</res-auth>
>> </resource-ref>
>>
>> I've created a context.xml that looks like:
>>
>> <Context
>> docBase="${catalina.home}/webapps/myapp" path=""
>> reloadable="false">
>> <Resource name="jdbc/myappqa"
>> description =
>> "MYAPP connection pool"
>> auth="Container"
>>
>> type="com.mchange.v2.c3p0.ComboPooledDataSource"
>>
>> username="myappuser"
>>
>> password="myapppassword"
>>
>> driverClass="com.ibm.db2.jcc.DB2Driver"
>>
>> url="jdbc:db2://mydb2server:50000/TESTDATA"
>>
>> factory="org.apache.naming.factory.BeanFactory"
>> minPoolSize="15"
>> .
>> .<scissors of
>> brevity applied - more parameters set>
>> .
>> />
>> </Context>
>>
>>
>> I've been able to browse to the app and get a login page,
>> but things explode at login attempt, i.e., first attempt to
>> access the data source.
>>
>> Question 1: For this to work, do I need to add
>> "WEB-INF/lib" to the "Classpath:" list? There are
>> about 80 jar files (including log4j, ftpbean, Hibernate) in
>> there aside from the symlinks I've added for the c3p0, JDBC
>> driver, and license jar files.
>>
>> Question 2: In my context.xml, is that one parameter
>> supposed to be "driverClass" or "driverClassName"?
>> I've seen both used seemingly for the same purpose.
>>
>> Question 3: Some customization has been done
>> involving hibernate.properties which I don't think is
>> necessarily causing a problem (its "meat" has been replaced
>> by a reference to another file much like server.xml), but in
>> there I've noticed this:
>>
>> <property
>> name="hibernate.connection.pool_size">15</property>
>>
>> As I understand it, setting this parameter activates
>> Hibernate's own connection pooler and further that
>> Hibernate's own connection pooler is not supposed to be used
>> in any capacity other than learning and testing. Does
>> having this setting be in here mean that this app was built
>> (intentionally or not - likely not) to use Hibernate's
>> connection pooler and c3p0 end-to-end?
>>
>> Thanks in advance for your opinions/assistance.
>>
>>
>>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
>
>
>
Re: Porting app from Tomcat 5.0.28 to 6.0.26
Posted by Mark Eggers <it...@yahoo.com>.
Here's a link from the Tomcat Wiki.
http://wiki.apache.org/tomcat/TomcatHibernate
The bottom portion of the document explains how to use Hibernate to manage database pooling instead of Tomcat.
I hope it gives you some leads.
. . . . just my two cents
/mde
--- On Thu, 5/13/10, Jeff Hubbs <jh...@att.net> wrote:
> From: Jeff Hubbs <jh...@att.net>
> Subject: Porting app from Tomcat 5.0.28 to 6.0.26
> To: "Tomcat Users List" <us...@tomcat.apache.org>
> Date: Thursday, May 13, 2010, 12:55 PM
> Hello -
>
> I have a DB2-backed legacy app on a legacy platform that
> I'm trying to modernize. My objective is to modernize
> the platform underneath the app (Gentoo Linux for now,
> Tomcat 6.0.26, Sun JDK 1.6.0.20) and do so in a way that a
> longtime Java/Tomcat integrator would readily recognize (I'm
> not one). App uses Hibernate and c3p0; Hibernate is
> packaged in the app's war but c3p0 is not; I've installed
> c3p0 through Gentoo's usual package management system.
> I've also brought in the jar for the proper version of IBM
> DB2 JDBC driver and its corresponding "license jar" to match
> the DB2 instance version (versioning between DB2 and JDBC
> driver are tightly coupled).
>
> On the legacy Tomcat 5.0 / JDK 1.5 platform, the database
> connection configuration info is handled in a seemingly
> customized way - something to do with virtual hosts.
> At the top of the Tomcat-instance-wide server.xml file is
> this structure:
>
> <!DOCTYPE web-app[
> <!ENTITY vhosts SYSTEM "vhosts.xml">
> ]>
>
> But for now, I'm not interested in dealing with any kind of
> virtual host arrangement. The impetus behind that was
> so that users can run two independent sessions of the app in
> two separate browser tabs or windows .
>
> In the vhosts.xml file is info that looks like it ought to
> belong in the app's context.xml file. I understand
> that how context sections are written have changed since 5.0
> and I *think* I've got that worked out.
>
> The app's original MANIFEST.MF file has this in it:
>
> Classpath:
> WEB-INF/classes/mycapp/resource
> WEB-INF/classes/myapp/resource
> /tld
> WEB-INF/classes/elms/resource/hbm/MYAPP
>
> So: given a working platform and after deploying the
> app war that I've been given (let's call it "myapp.war"),
> here are the post-deploy steps I've worked out so far:
>
> * Create a symlink for
> $CATALINA_BASE/webapps/myapp/WEB-INF/lib/c3p0.jar to where
> the package manager has put c3p0.jar
>
> * Create symlinks for db2jcc.jar and db2jcc_license_cu.jar
> in $CATALINA_BASE/webapps/myapp/WEB-INF/lib to where I've
> put them under /usr/src
>
> * Generate a new
> $CATALINA_BASE/webapps/myapp/META-INF/context.xml (see
> below) and symlink
> $CATALINA_BASE/conf/Catalina/localhost/myapp.xml to it
>
> * Add the following to
> $CATALINA_BASE/webapps/myapp/WEB-INF/web.xml, before the
> closing "</web-app>":
>
> <resource-ref>
> <description>DB connection pool for
> MYAPP</description>
> <res-ref-name>jdbc/myappqa</res-ref-name>
> <res-type>com.mchange.v2.c3p0.ComboPooledDataSource</res-type>
> <res-auth>Container</res-auth>
> </resource-ref>
>
> I've created a context.xml that looks like:
>
> <Context
> docBase="${catalina.home}/webapps/myapp" path=""
> reloadable="false">
> <Resource name="jdbc/myappqa"
> description =
> "MYAPP connection pool"
> auth="Container"
>
> type="com.mchange.v2.c3p0.ComboPooledDataSource"
>
> username="myappuser"
>
> password="myapppassword"
>
> driverClass="com.ibm.db2.jcc.DB2Driver"
>
> url="jdbc:db2://mydb2server:50000/TESTDATA"
>
> factory="org.apache.naming.factory.BeanFactory"
> minPoolSize="15"
> .
> . <scissors of
> brevity applied - more parameters set>
> .
> />
> </Context>
>
>
> I've been able to browse to the app and get a login page,
> but things explode at login attempt, i.e., first attempt to
> access the data source.
>
> Question 1: For this to work, do I need to add
> "WEB-INF/lib" to the "Classpath:" list? There are
> about 80 jar files (including log4j, ftpbean, Hibernate) in
> there aside from the symlinks I've added for the c3p0, JDBC
> driver, and license jar files.
>
> Question 2: In my context.xml, is that one parameter
> supposed to be "driverClass" or "driverClassName"?
> I've seen both used seemingly for the same purpose.
>
> Question 3: Some customization has been done
> involving hibernate.properties which I don't think is
> necessarily causing a problem (its "meat" has been replaced
> by a reference to another file much like server.xml), but in
> there I've noticed this:
>
> <property
> name="hibernate.connection.pool_size">15</property>
>
> As I understand it, setting this parameter activates
> Hibernate's own connection pooler and further that
> Hibernate's own connection pooler is not supposed to be used
> in any capacity other than learning and testing. Does
> having this setting be in here mean that this app was built
> (intentionally or not - likely not) to use Hibernate's
> connection pooler and c3p0 end-to-end?
>
> Thanks in advance for your opinions/assistance.
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org