Hi,
I know many people encountered this problem before, but I still couldn't figure it out... I got this error when configuring
JDBC datasource for
Tomcat and
Struts:
Exception: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class '' for connect URL 'null', cause: No suitable driver
Please note that the class is empty and connect URL is null, but I did supply the necessary info in my server.xml file based on the instructions on Apache website, and my JDBC driver is under tomcat/commin/lib directory.
Here's my server.xml file: I configure JDBC datasource as a Global resource for JNDI lookup:
<code>
<GlobalNamingResources>
<Resource name="jdbc/oracle" auth="Container" type="javax.sql.DataSource"
description="Oracle database connection" >
</Resource>
<ResourceParams name="jdbc/oracle">
<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
racle:thin:@<server URL>:1521:<SID></value>
</Parameter>
<Parameter>
<name>username</name>
<value>****</value>
</Parameter>
<Parameter>
<name>password</name>
<value>****</value>
</Parameter>
</ResourceParams>
</code>
My web.xml:<code>
<resource-ref>
<description>DB Connection Pool</description>
<res-ref-name>jdbc/oracle</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref></code>
I didn't put any extra info about the resource in my context.xml file, except default configuation. Shall I put anything in the file to associate the global resource for my context? Doesn't gloabl resource automcatically available to all contexts?
Another question is: Both Tomcat and Struts allow us to configure datasource in the config file. Where is the better place to handle this: server.xml for Tomcat or struts-config.xml? Is there any performance difference among the 2, even if both configuration use the same datasource class. (I chose to use Tomcat because it seems Struts now only allow us to get DataSource from Action class, and I need JDBC datasource for application service initialization. Or is there other ways to get datasource from Struts? findDataSource is deprecated.)
Please help me with these problems. Any help is highly appreciated!!!
[ June 04, 2004: Message edited by: JW Li ]