Sunday 26 April 2015

Textual description of firstImageUrl

Driver Class Not Found Error In MULE

If you use mule built in C3P0 data connection pool to connect to databse , it throws ClassNotFoundException even if the driver class is present in MULE_HOME/APPS/{YOUR_APP}/lib directory .

com.mchange.v2.c3p0.DriverManagerDataSource - WARN - Could not load driverClass com.microsoft.sqlserver.jdbc.SQLServerDriver
java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver
 at java.net.URLClassLoader$1.run(Unknown Source)
 at java.net.URLClassLoader$1.run(Unknown Source)
 at java.security.AccessController.doPrivileged(Native Method)
 at java.net.URLClassLoader.findClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at java.lang.ClassLoader.loadClass(Unknown Source)
 at java.lang.Class.forName0(Native Method)
 at java.lang.Class.forName(Unknown Source)
 at com.mchange.v2.c3p0.DriverManagerDataSource.ensureDriverLoaded(DriverManagerDataSource.java:100)
 at com.mchange.v2.c3p0.DriverManagerDataSource.getConnection(DriverManagerDataSource.java:132)
 at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:182)
 at com.mchange.v2.c3p0.WrapperConnectionPoolDataSource.getPooledConnection(WrapperConnectionPoolDataSource.java:171)
 at com.mchange.v2.c3p0.impl.C3P0PooledConnectionPool$1PooledConnectionResourcePoolManager.acquireResource(C3P0PooledConnectionPool.java:137)
 at com.mchange.v2.resourcepool.BasicResourcePool.doAcquire(BasicResourcePool.java:1014)
 at com.mchange.v2.resourcepool.BasicResourcePool.access$800(BasicResourcePool.java:32)
 at com.mchange.v2.resourcepool.BasicResourcePool$AcquireTask.run(BasicResourcePool.java:1810)
 at com.mchange.v2.async.ThreadPoolAsynchronousRunner$PoolThread.run(ThreadPoolAsynchronousRunner.java:547)
So if you use database connector configuration or create a separate spring bean for C3P0 datasource , it will not work .This is known bug . If you are using mule 3.5.0 , you might face this error . Solution :

1 ) Put your Driver class Jar file in MULE_HOME/lib folder instead of your app folder .
OR
2 ) Use some other datasource like CommonsDBCP .
Post Comments And Suggestions !!