Why JBoss Fuse can not load JDBC driver class org.h2.Driver ?

Solution Unverified - Updated -

Issue

  • While working on JBoss Fuse POC to integrate with database, I'm testing on H2 database and will integrate to Oracle DB later. I setup the camel flow with following configuration:
      1. Setup H2 database and create database table
      1. Install H2 JAR ( JDBC is in that jar) into maven by using maven-install-plugin.
      1. Write simple route to select data from database ( see attach file for spring DSL) and included H2 (from 2) into pom.xml
      1. Following error occurred. Fuse can’t find h2 driver
org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class 'org.h2.Driver' at org.apache.commons.dbcp.BasicDataSource.createConnectionFactory(BasicDataSource.java:1429)[258:org.apache.commons.dbcp:1.4] at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:1371)[258:org.apache.commons.dbcp:1.4] at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:1044)[258:org.apache.commons.dbcp:1.4]
  • I tried to install H2 driver (from 2) with following
osgi:install -s wrap:mvn:org.h2.Driver/h2jdbc/1.4.186
dev:dynamic-import <id>
  • Now, JDBC driver can be loaded. but after I run "osgi:update <id>" then I need to re-run "dev:dynamic-import" again.
  • How to make this permanent? or any other way to solve this problem? And Should I do this with Oracle JDBC driver also?
  • How to use JDBC Connector in Fuse ?

Environment

  • Red Hat JBoss Fuse
    • 6.1.0

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