camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ashwin Karpe <aska...@progress.com>
Subject Re: Class not found exception when trying to load class with Class.forName("")
Date Thu, 11 Feb 2010 13:09:37 GMT

Hi,

If the driver is a plain old jar it is possible to deploy it as such using
the wrap protocol for example
  wrap:mvn:mygroupId/myartifactId/1.1 instead of handcrafting a manifest
entry... You need to install it in the maven repository first.

If the jar can be installed correctly and shows up as installed when you do
an "osgi/list" in Servicemix4.x
you can try
     <Import-Package>
           net.sourceforge.jtds.jdbc.Driver;version=1.2.2,
           *
     </Import-Package>

Not sure why the DynamicImport does not work but the Import Package has the
same effect while offering ore control.

Hope this helps.

Cheers,

Ashwin...


lekkie wrote:
> 
> Hi guys,
> 
> I am trying to use spring to manage datasource and I am using
> com.mchange.v2.c3p0.DriverManager.
> 
> I set my dynamicimport package to asterisk as shown below:
> <DynamicImport-Package>*</DynamicImport-Package>
> 
> I have mssqlserver driver all in one (net.sourceforge.jtds) added as a
> bundle, installed in servicemix with the ffg manifest:
> 
> Manifest-Version = 1.0
> Ant-Version = Apache Ant 1.6.1
> Created-By = 1.3.1_08-b03 (Sun Microsystems Inc.)
> Implementation-Title = jTDS JDBC Driver
> Implementation-Version = 1.2.2
> Implementation-URL = http://jtds.sourceforge.net
> Specification-Title = JDBC
> Specification-Version = 3.0
> Export-Package = net.sourceforge.jtds.jdbc.Driver;version="1.2.2"
> Main-Class = net.sourceforge.jtds.jdbc.Driver
> Class-Path = jcifs.jar
> 
> Each time I try to use the datasource it throws the ffg exception:
> 
> 09:53:16,158 | WARN  | er$PoolThread-#0 | DriverManagerDataSource         
> | 14logging.Jdk14MLog$Jdk14MLogger  148 | Could not load driverClass
> net.sourceforge.jtds.jdbc.Driver
> java.lang.ClassNotFoundException: net.sourceforge.jtds.jdbc.Driver
> 	at
> org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
> 	at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
> 	at
> org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
> 	at
> org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
> 	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
> 	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
> 	at java.lang.Class.forName0(Native Method)
> 	at java.lang.Class.forName(Class.java:164)
> 	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)
> 
> What am I doin wrong?
> 
> kr.
> 


-----
--- 
Ashwin Karpe, Principal Consultant, PS - Opensource Center of Competence 
Progress Software Corporation
14 Oak Park Drive
Bedford, MA 01730
--- 
+1-972-304-9084 (Office) 
+1-972-971-1700 (Mobile) 
---- 
Blog: http://opensourceknowledge.blogspot.com/


-- 
View this message in context: http://old.nabble.com/Class-not-found-exception-when-trying-to-load-class-with-Class.forName%28%22%22%29-tp27544168p27544558.html
Sent from the Camel - Users mailing list archive at Nabble.com.


Mime
View raw message