Cannot create JDBC driver error: BasicDataSource with Oracle
dlo1957 Mar 17, 2011 6:02 PMI am getting an error when trying to use a "org.apache.commons.dbcp.BasicDataSource" with Oracle:
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot create JDBC driver of class 'oracle.jdbc.OracleDriver' for connect URL 'jdbc:oracle:thin:@127.0.0.1:1521:XE'
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1163)[194:org.apache.servicemix.bundles.commons-dbcp:1.2.2.6]
...
Caused by: java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:264)[:1.6.0_23]
I realize that many people have the following issue. I have looked at:
http://fusesource.com/forums/thread.jspa?messageID=7745
http://fusesource.com/forums/thread.jspa?messageID=8620
as well as other issues related to this type of error.
I am using version 4.3.0-fuse-03-00.
1) What I did was to create a bundle fragment called "dbcp-oracle-fragment" as suggested in one of the above posts.
From what I can see in "dbcp-oracle-fragment" after it is installed:
- Imported Packages oracle.jdbc from com.springsource.oracle.jdbc (195)
- Fragment-Host: org.apache.servicemix.bundles.commons-dbcp; bundle-version=1.2.2
Here's more detailed information.
a) In "dbcp-oracle-fragment"
Integration Services :: DBCP Fragment :: Oracle Driver (dbcp-oracle-fragment)
Symbolic Name dbcp-oracle-fragment
Version 1.0.02.SNAPSHOT
Bundle Location mvn:ca.ne2.integration/dbcp-oracle-fragment/1.0.02-SNAPSHOT
Last Modification Thu Mar 17 15:41:27 MDT 2011
Bundle Documentation http://fusesource.com/
Vendor FuseSource
Description This pom provides project information that is common to all ServiceMix branches.
Start Level 60
Imported Packages oracle.jdbc from com.springsource.oracle.jdbc (195)
Manifest Headers Manifest-Version: 1.0
Built-By: dlo
Tool: Bnd-0.0.357
Bundle-Name: Integration Services :: DBCP Fragment :: Oracle Driver
Created-By: Apache Maven Bundle Plugin
Bundle-Vendor: FuseSource
Fragment-Host: org.apache.servicemix.bundles.commons-dbcp; bundle-version=1.2.2
Build-Jdk: 1.6.0_23
Bundle-Version: 1.0.02.SNAPSHOT
Bnd-LastModified: 1300396354422
Bundle-ManifestVersion: 2
Bundle-Description: This pom provides project information that is common to all ServiceMix branches.
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Bundle-SymbolicName: dbcp-oracle-fragment
Bundle-DocURL: http://fusesource.com/
Import-Package: oracle.jdbc
b) Here's what bundle "org.apache.servicemix.bundles.commons-dbcp" looks like:
Apache ServiceMix :: Bundles :: commons-dbcp (org.apache.servicemix.bundles.commons-dbcp)
Symbolic Name org.apache.servicemix.bundles.commons-dbcp
Version 1.2.2.6
Bundle Location mvn:org.apache.servicemix.bundles/org.apache.servicemix.bundles.commons-dbcp
Last Modification Thu Mar 17 15:16:06 MDT 2011
Bundle Documentation http://www.apache.org/
Vendor The Apache Software Foundation
Description This bundle simply wraps commons-dbcp-1.2.2.jar.
Start Level 60
Exported Packages org.apache.commons.dbcp,version=1.2.2
org.apache.commons.dbcp,version=1.2.2
org.apache.commons.dbcp.cpdsadapter,version=1.2.2
org.apache.commons.dbcp.cpdsadapter,version=1.2.2
org.apache.commons.dbcp.datasources,version=1.2.2
org.apache.commons.dbcp.datasources,version=1.2.2
org.apache.commons.jocl,version=1.2.2
org.apache.commons.jocl,version=1.2.2
Imported Packages javax.naming,version=0.0.0 from org.eclipse.osgi (0)
javax.naming.spi,version=0.0.0 from org.eclipse.osgi (0)
javax.sql,version=0.0.0 from org.eclipse.osgi (0)
org.apache.commons.pool,version=1.5.4 from org.apache.servicemix.bundles.commons-pool (37)
org.apache.commons.pool.impl,version=1.5.4 from org.apache.servicemix.bundles.commons-pool (37)
org.xml.sax,version=0.0.0 from org.eclipse.osgi (0)
org.xml.sax.helpers,version=0.0.0 from org.eclipse.osgi (0)
Importing Bundles ca.ne2.integration.in.ne.exchange.ne-exchange-event-consumer (202)
neis-common-oracle-pool (197)
Manifest Headers Manifest-Version: 1.0
Built-By: jb
Created-By: Apache Maven Bundle Plugin
Bundle-License: http://www.apache.org/licenses/LICENSE-2.0.txt
Import-Package: javax.naming, javax.naming.spi, javax.sql, org.apache.commons.pool; version="[1.3, 2)", org.apache.commons.pool.impl; version="[1.3, 2)", org.xml.sax, org.xml.sax.helpers
Bnd-LastModified: 1282729401614
Export-Package: org.apache.commons.dbcp.cpdsadapter; uses:="javax.naming, org.apache.commons.pool.impl, org.apache.commons.pool, javax.naming.spi, javax.sql, org.apache.commons.dbcp"; version="1.2.2", org.apache.commons.dbcp.datasources; uses:="org.apache.commons.pool, org.apache.commons.dbcp, javax.sql, javax.naming, javax.naming.spi, org.apache.commons.pool.impl"; version="1.2.2", org.apache.commons.dbcp; uses:="org.apache.commons.pool.impl, org.apache.commons.pool, javax.sql, javax.naming, javax.naming.spi, org.xml.sax, org.apache.commons.jocl"; version="1.2.2", org.apache.commons.jocl; uses:="org.xml.sax, org.xml.sax.helpers"; version="1.2.2"
Bundle-Version: 1.2.2.6
Bundle-Name: Apache ServiceMix :: Bundles :: commons-dbcp
Bundle-Description: This bundle simply wraps commons-dbcp-1.2.2.jar.
Build-Jdk: 1.5.0_14
Bundle-DocURL: http://www.apache.org/
Bundle-Vendor: The Apache Software Foundation
Bundle-ManifestVersion: 2
Bundle-SymbolicName: org.apache.servicemix.bundles.commons-dbcp
Tool: Bnd-0.0.357
c) My data source is defined as:
I've spent hours on this and I am at a loss as what to do next.
Does anyone have any ideas on what the problem is?
Thanks.