Hi,

I've been developing a small app which utilizes Commons-DBCP to connect to a 
MySQL database. In karaf 2.2.4 this has been working fine, but starting in 
version 2.2.5 it fails to find the MySQL bundle:

Caused by: java.sql.SQLException: No suitable driver found for 
jdbc:mysql://localhost/mydb
        at 
java.sql.DriverManager.getConnection(DriverManager.java:602)[:1.6.0_31]
        at 
java.sql.DriverManager.getConnection(DriverManager.java:185)[:1.6.0_31]
        at 
org.apache.commons.dbcp.DriverManagerConnectionFactory.createConnection(DriverManagerConnectionFactory.java:75)
        at 
org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582)
        at 
org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:1181)
        at 
org.apache.commons.dbcp.PoolingDataSource.getConnection(PoolingDataSource.java:106)
...

The code looks like this:

ConnectionFactory connectionFactory =
                                        new DriverManagerConnectionFactory(
                                                "jdbc:mysql://localhost/db",
                                                "user",
                                                "pwd");

ObjectPool connectionPool = new GenericObjectPool();

PoolableConnectionFactory poolableConnectionFactory =
        new PoolableConnectionFactory(connectionFactory, connectionPool,
        null, "SELECT 1", false, true);

PoolingDataSource dataSource = new PoolingDataSource(connectionPool);

In karaf 2.2.4 (default config, straight from tar-ball) this was working fine.
In karaf 2.2.5 (default config here as well) and up, it doesn't.

The following bundles are used:

org.apache.servicemix.bundles.commons-dbcp-1.4_1.jar
mysql-connector-java-5.1.18-bin.jar
commons-pool-1.5.6.jar


If I try to set up the data source manually, it works fine though:

BasicDataSource bds = new BasicDataSource();
bds.setDriverClassName("com.mysql.jdbc.Driver");
bds.setUrl("jdbc:mysql://localhost/db");
bds.setUsername("user");
bds.setPassword("pwd");


My manifest:
[IMPEXP]
Import-Package
  com.mysql.jdbc                        
  javax.sql                             
  org.apache.commons.dbcp               
  org.apache.commons.pool               
  org.apache.commons.pool.impl          
  org.osgi.framework                    {version=1.5}
Export-Package
  se.stromnet.mypackage                {version=1.0.0}



Any ideas why this has stopped working? I've gone through the changelogs but 
cannot find any good indication what might be causing this.. Any help is 
appreciated!

Thank you
Johan

Reply via email to