By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,984 Members | 1,461 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,984 IT Pros & Developers. It's quick & easy.

Tomcat 5: files in $CATALINA_HOME/conf/Catalina/localhost

P: n/a
Hello!

I tried to get my J2EE app working with DB2 for several days and now
it seems to work, but... (Tomcat 5.0.19 on NT 4.0 with J2SDK 1.4.1_02)

1) Declaring the DB2-datasource in $CATALINA_HOME/conf/server.xml did
not work.
All I got was a message like "Cannot create JDBC driver of class ''
for connect URL 'null', cause: null"

2) DB2-Driver (COM.ibm.db2.jdbc.app.DB2Driver) is in
CATALINA_HOME/common/lib, file renamed from db2java.zip to db2java.jar

3) I tried to place the ResourceParams in <GlobalNamingResources>,
then in <Context...>, but nothing worked for me...

4) Finally I placed a file myApp.xml in
$CATALINA_HOME/conf/Catalina/localhost and declared the datasource in
this file.

5) This way it works fine now. But here comes the question: Is it "the
right way" to place my config-file in
$CATALINA_HOME/conf/Catalina/localhost?

Thanks for each helpful idea.
Oliver

//--- Content of $CATALINA_HOME/conf/Catalina/localhost/myApp.xml
---------
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="myApp" path="/myApp"
docBase="D:\Programme\jakarta-tomcat-5.0.19\webapps\myApp">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="myApp_log." suffix=".txt"
timestamp="true"/>
<Resource auth="Container" name="jdbc/myApp"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/myApp">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFact ory</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>password</name>
<value>...</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:db2:myApp</value>
</parameter>
<parameter>
<name>driverName</name>/database
<value>jdbc:db2:myApp</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>COM.ibm.db2.jdbc.app.DB2Driver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>username</name>
<value>...</value>
</parameter>
</ResourceParams>
</Context>
// --- EOF -----------
Jul 17 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
Hi Oliver,

i had the same problem. It's not solved, but try to remove the line:

<Resource auth="Container" name="jdbc/myApp"
type="javax.sql.DataSource"/>

from the myApp.xml file and place it into your web.xml of your
application.
Now i am getting the following Exception:

Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create
JDBC driver of class 'COM.ibm.db2.jdbc.app.DB2Driver' for connect URL
'jdbc:db2:DB', cause: No suitable driver

I placed the db2java.jar in the %CATALINA_HOME%/common/lib and the
application WEB-INF/lib directory. None was succesful.

Hope anybody has a solution.

Greeting
oh*****@hotmail.com (Oliver Hoehle) wrote in message news:<68**************************@posting.google. com>...
Hello!

I tried to get my J2EE app working with DB2 for several days and now
it seems to work, but... (Tomcat 5.0.19 on NT 4.0 with J2SDK 1.4.1_02)

1) Declaring the DB2-datasource in $CATALINA_HOME/conf/server.xml did
not work.
All I got was a message like "Cannot create JDBC driver of class ''
for connect URL 'null', cause: null"

2) DB2-Driver (COM.ibm.db2.jdbc.app.DB2Driver) is in
CATALINA_HOME/common/lib, file renamed from db2java.zip to db2java.jar

3) I tried to place the ResourceParams in <GlobalNamingResources>,
then in <Context...>, but nothing worked for me...

4) Finally I placed a file myApp.xml in
$CATALINA_HOME/conf/Catalina/localhost and declared the datasource in
this file.

5) This way it works fine now. But here comes the question: Is it "the
right way" to place my config-file in
$CATALINA_HOME/conf/Catalina/localhost?

Thanks for each helpful idea.
Oliver

//--- Content of $CATALINA_HOME/conf/Catalina/localhost/myApp.xml
---------
<?xml version='1.0' encoding='utf-8'?>
<Context displayName="myApp" path="/myApp"
docBase="D:\Programme\jakarta-tomcat-5.0.19\webapps\myApp">
<Logger className="org.apache.catalina.logger.FileLogger"
prefix="myApp_log." suffix=".txt"
timestamp="true"/>
<Resource auth="Container" name="jdbc/myApp"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/myApp">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFact ory</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>password</name>
<value>...</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:db2:myApp</value>
</parameter>
<parameter>
<name>driverName</name>/database
<value>jdbc:db2:myApp</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>COM.ibm.db2.jdbc.app.DB2Driver</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>username</name>
<value>...</value>
</parameter>
</ResourceParams>
</Context>
// --- EOF -----------

Jul 17 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.