Error "No suitable driver found for ..." raised with SqlComponent in JBoss Fuse

Solution Verified - Updated -

Issue

  • I've installed mysql lib bundle containing JDBC driver for connecting to DB:

    [1459] [Active     ] [            ] [       ] [   70] Oracle Corporation's JDBC Driver for MySQL (5.1.36)
    
  • I've assigned level 70 against my bundle level 80:

    [1460] [Active     ] [            ] [Started] [   80] Example Project XXXXX (2.0.1.SNAPSHOT)
    
  • Now, the bundle with ID 1460 need JDBC driver in order to communicate with MySQL. Inside my bundle 's Spring config I have:

    <bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
        <property name="dataSource" ref="dataSource"/>
    </bean>
    <bean id="dataSource"
          class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="com.mysql.jdbc.Driver" />
        <property name="url" value="jdbc:mysql://localhost:3306/ESB_DB" />
        <property name="username" value="xxxxx" />
        <property name="password" value="xxxxx" />
    </bean>
    
  • But when I install the bundle and the process starts, the following error is raised:

10:14:10,695 | WARN  | rom%20TEST_TABLE | SqlConsumer                      | 198 - org.apache.camel.camel-core - 2.15.1.redhat-620133 | Consumer Co
nsumer[sql://select%20*%20from%20TEST_TABLE] failed polling endpoint: Endpoint[sql://select%20*%20from%20TEST_TABLE]. Will try again at next poll. 
Caused by: [org.springframework.jdbc.CannotGetJdbcConnectionException - Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ESB_DB]
org.springframework.jdbc.CannotGetJdbcConnectionException: Could not get JDBC Connection; nested exception is java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ESB_DB
        at org.springframework.jdbc.datasource.DataSourceUtils.getConnection(DataSourceUtils.java:80)[1255:org.apache.servicemix.bundles.spring-jdbc:3.2.12.RELEASE_1]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:575)[1255:org.apache.servicemix.bundles.spring-jdbc:3.2.12.RELEASE_1]
        at org.springframework.jdbc.core.JdbcTemplate.execute(JdbcTemplate.java:617)[1255:org.apache.servicemix.bundles.spring-jdbc:3.2.12.RELEASE_1]
        at org.apache.camel.component.sql.SqlConsumer.poll(SqlConsumer.java:92)[1256:org.apache.camel.camel-sql:2.15.1.redhat-620133]
        at org.apache.camel.impl.ScheduledPollConsumer.doRun(ScheduledPollConsumer.java:174)[198:org.apache.camel.camel-core:2.15.1.redhat-620133]
        at org.apache.camel.impl.ScheduledPollConsumer.run(ScheduledPollConsumer.java:101)[198:org.apache.camel.camel-core:2.15.1.redhat-620133]
        at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)[:1.8.0_05]
        at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)[:1.8.0_05]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)[:1.8.0_05]
        at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)[:1.8.0_05]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_05]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_05]
        at java.lang.Thread.run(Thread.java:745)[:1.8.0_05]
Caused by: java.sql.SQLException: No suitable driver found for jdbc:mysql://localhost:3306/ESB_DB
        at java.sql.DriverManager.getConnection(DriverManager.java:689)[:1.8.0_05]
        at java.sql.DriverManager.getConnection(DriverManager.java:208)[:1.8.0_05]
        at org.springframework.jdbc.datasource.DriverManagerDataSource.getConnectionFromDriverManager(DriverManagerDataSource.java:173)[1255:org.apache.servicemix.bundles.spring-jdbc:3.2.12.RELEASE_1]

Environment

  • Red Hat JBoss Fuse
    • 6.x

Subscriber exclusive content

A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.

Current Customers and Partners

Log in for full access

Log In

New to Red Hat?

Learn more about Red Hat subscriptions

Using a Red Hat product through a public cloud?

How to access this content