Cannot load JDBC driver class
mwilken Nov 6, 2014 9:02 PMI've been working through Christina's Homeloan demo for Fuse 6.1 in anticipation of move our current system from 4.6 to 6.1(big change between the two)
I've gotten it to work except for the issues with getting the JDBC connection to my database up and running on ESB.
The message I get two errors
The first when I start the project
Could not refresh JMS Connection for destination 'customer' - retrying in 5000 ms. Cause: Error while attempting to add new Connection to the pool; nested exception is javax.jms.JMSException: Could not connect to broker URL: tcp://localhost:61616. Reason: java.net.ConnectException: Connection refused: connect
And the second when I try to save the data to the database.
Failed delivery for (MessageId: queue_customer_ID____________-62836-1415321625775-7_1_1_1_1 on ExchangeId: ID-DHSCT1082884-62834-1415321624921-1-1). Exhausted after delivery attempt: 1 caught: org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'com.microsoft.sqlserver.jdbc.SQLServerDriver'
The demo uses postgres but since I don't have that, I've been attempting to connect to our SqlServer DBs. The project works correctly and saves the data when I do a camel:run so I know the underlying routes are good. So it has to be in the packaging and configuration of what I deploy to the server.
Here is what I hope is the relevant data and someone can see where I when wrong.
In the blueprint customerinfo.xml
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close"> |
<property name="driverClassName" value="com.microsoft.sqlserver.jdbc.SQLServerDriver"/>
<property name="url" value="jdbc:sqlserver://training-warehouse:1433;DatabaseName=test"/>
<property name="username" value="test"/>
<property name="password" value="test"/>
</bean>
<!-- configure the Camel SQL component to use the JDBC data source -->
<bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
<property name="dataSource" ref="dataSource"/>
</bean>
in the pom.xml
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<fabric8.parentProfiles>feature-camel</fabric8.parentProfiles>
<fabric8.profile>gettingstarted</fabric8.profile>
<fabric8.bundles>wrap:mvn:com.microsoft.sqlserver/sqljdbc4/4.0 mvn:commons-dbcp/commons-dbcp/1.4</fabric8.bundles>
<fabric8.features> war camel-cxf cxf camel-http4 camel-jaxb camel-sql camel-jackson</fabric8.features>
<fabric8.featureRepos>mvn:org.apache.camel.karaf/apache-camel/${version:camel}/xml/features</fabric8.featureRepos>
</properties>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
</dependency>
This was my latest attempt.
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>homeloan</Bundle-SymbolicName>
<Private-Package>org.blogdemo.homeloan.*</Private-Package>
<!-- <Import-Package>oft.postgresql,*</Import-Package> -->
<_exportcontents>org.microsoft.sqlserver.*</_exportcontents> <--- I added this -->
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
I found sqldbc4-4.0.jar C:\JBoss\Fuse\jboss-fuse-6.1.0.redhat-379\instances\demoContainer but evidently this isn't in the class path not sure where to go from here