Application Bundle unable to find datasource driver class when deployed on JBoss Fuse
Issue
- How to import datasource driver class in a
bundle. - I am attempting to modify this existing project on github to use
postgresqldriver andpostgresqldatabase. Thedatasourcebundle contains thepostgresqldatasource. The routing bundle contains routes that references the datasource. Instead of deploying as a feature, i am deploying them individually asosgi bundlesto troubleshoot the exception. - Please advise why the exception is being thrown or how to resolve or troubleshoot this issue. I have used the
postgresqlversion that is listed under the supported configuration. - Not able to deploy a bundle on
JBoss Fuseserver. I am getting the below :-
Caused by: org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.postgresql.Driver'
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)[273:org.apache.commons.dbcp:1.4]
at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)[273:org.apache.commons.dbcp:1.4]
at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)[273:org.apache.commons.dbcp:1.4]
at org.springframework.jdbc.datasource.DataSourceUtils.doGetConnection(DataSourceUtils.java:111)[258:org.apache.servicemix.bundles.spring-jdbc:3.2.9.RELEASE_1]
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:77)[258:org.apache.servicemix.bundles.spring-jdbc:3.2.9.RELEASE_1]
... 25 more
Caused by: java.lang.ClassNotFoundException: org.postgresql.Driver from bundle 291 (sample)
at org.apache.camel.core.osgi.utils.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:78)[151:org.apache.camel.camel-blueprint:2.12.0.redhat-611412]
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)[:1.7.0_75]
at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1420)[273:org.apache.commons.dbcp:1.4]
... 29 more
- Unable to load JDBC driver class, getting below exception.
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)[org.apache.servicemix.bundles:org.apache.servicemix.bundles.spring-jdbc:3.2.12.RELEASE_2]
at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:575)[org.apache.servicemix.bundles:org.apache.servicemix.bundles.spring-jdbc:3.2.12.RELEASE_2]
- The following optional
importswere not satisfied:-
javax.xml.bind.annotation
org.apache.activemq.camel.component
org.apache.camel
org.apache.camel.component.sql
org.apache.camel.util
org.apache.commons.dbcp
org.osgi.service.blueprint
Environment
- Red Hat JBoss Fuse
- 6.2.1
- 6.2.0
- 6.1.0
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase of over 48,000 articles and solutions.
Welcome! Check out the Getting Started with Red Hat page for quick tours and guides for common tasks.
