I got it working now. But, it still does not work within the <DefaultContext>. It is only working when I have the <ResourceLink> in the <Context> element.
According to the docs (http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/defaultcontext.html) it should be working fine this way. Anyone any clue?
Thanks.
Klaas
From: [EMAIL PROTECTED]
Reply-To: "Tomcat Users List" <[EMAIL PROTECTED]>
To: "Tomcat Users List" <[EMAIL PROTECTED]>
Subject: Re: global naming resource not available in webapp
Date: Fri, 20 Dec 2002 08:41:40 -0600
Klaas:
Make sure you have the <ResouceLink> Tag inside each context that needs to
use this
datasource. Also, in using Global Resources, there is no need for a
<resource-ref> tag
in your web.xml config file anymore.
A possible error is your driverClassName parameter. You have it set up as:
oracle.jdbc.pool.OracleConnectionPoolDataSource
This is not a driver, but rather Oracles Connection Pooling. You could use
that
in place of the Apache Commons DBCP
org.apache.commons.dbcp.BasicDataSourceFactory
So, replace your driverClassName with:
oracle.jdbc.driver.OracleDriver
Here is mine for you to compare with:
<Resource name="MAXDEV" scope="Shareable" type="javax.sql.DataSource"/>
<ResourceParams name="MAXDEV">
<parameter>
<name>validationQuery</name>
<value>SELECT * FROM DUAL</value>
</parameter>
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@SERVER:PORT:SID</value>
</parameter>
<parameter>
<name>password</name>
<value>PASSWORD</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>4</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>5000</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.driver.OracleDriver</value>
</parameter>
<parameter>
<name>username</name>
<value>USERNAME</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
</ResourceParams>
Then my Resouce Link looks like:
<ResourceLink global="MAXDEV" name="jdbc/MAXDEV" type
="javax.sql.DataSource"/>
I put this resouce link in each Context that needs access to the database.
Here is the link to the documentation about Global Resources. I read this
documentation
for a few hours when I setup mine originally.
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/config/globalresources.html
Hope this helps,
Ej
"Klaas van der Ploeg" <[EMAIL PROTECTED]> on 12/20/2002 08:05:54 AM
Please respond to "Tomcat Users List" <[EMAIL PROTECTED]>
To: [EMAIL PROTECTED]
cc:
Subject: global naming resource not available in webapp
Hi,
I have multiple webapps which must share the same dataresource (DBCP to
Oracle DB). Currently I'm using this resource from the <DefaultContext>
element, it works fine there.
But, I was wondering if I can make it 'globally' available in the
<GlobalNamingResources> element. The docs say that it should be possible,
but I'm not getting it to work, it seems (by debugging) that the factory is
called, but it is missing the parameter values.
This is my resource definition (same as in <DefaultContext>) in
GlobalNamingResources:
<GlobalNamingResources>
<Resource name="jdbc/oracledb" auth="Container"
type="javax.sql.DataSource"/>
<ResourceParams name="jdbc/oracledb">
<parameter>
<name>factory</name>
<value>org.apache.commons.dbcp.BasicDataSourceFactory</value>
</parameter>
<parameter>
<name>driverClassName</name>
<value>oracle.jdbc.pool.OracleConnectionPoolDataSource</value>
</parameter>
<parameter>
<name>url</name>
<value>jdbc:oracle:thin:@dbhost:1521:db</value>
</parameter>
<parameter>
<name>username</name>
<value>someuser</value>
</parameter>
<parameter>
<name>password</name>
<value>somepassword</value>
</parameter>
<parameter>
<name>maxActive</name>
<value>20</value>
</parameter>
<parameter>
<name>maxIdle</name>
<value>2</value>
</parameter>
<parameter>
<name>maxWait</name>
<value>-1</value>
</parameter>
</ResourceParams>
</GlobalNamingResources>
My questions:
1. Is this the preferred approach?
2. Why is it not working? I'm getting a SQLE: java.sql.SQLException: Cannot
load JDBC driver class 'null'
Thanks for your help,
Klaas
_________________________________________________________________
MSN 8: advanced junk mail protection and 3 months FREE*.
http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU
http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_advancedjmf_3mf
--
To unsubscribe, e-mail: <
mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <
mailto:[EMAIL PROTECTED]>
**********************************************************************************
Confidentiality Notice: This email message, including any attachments,
contains or may contain confidential information intended only for the
addressee. If you are not an intended recipient of this message, be
advised that any reading, dissemination, forwarding, printing, copying
or other use of this message or its attachments is strictly prohibited. If
you have received this message in error, please notify the sender
immediately by reply message and delete this email message and any
attachments from your system.
**********************************************************************************
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
_________________________________________________________________
MSN 8: advanced junk mail protection and 3 months FREE*. http://join.msn.com/?page=features/junkmail&xAPID=42&PS=47575&PI=7324&DI=7474&SU= http://www.hotmail.msn.com/cgi-bin/getmsg&HL=1216hotmailtaglines_advancedjmf_3mf
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>
