Hi, I do not see an issue with jtds.jar. It seems to be deployed and has exported its packages.
This may require some debgging. I have heard Guillaume Nodet mentioning at one time that Karaf does not use class.forName() (aka Java reflection) to resolve bundles. I wonder if there may be something here that I do not quite see. This will involve some debugging. Can you please raise an Jira issue and log this so that Servicemix folks can advise here as well. Cheers, Ashwin... lekkie wrote: > > Hi, thanks for you response. Much appreciated. > > I tried something different. I tried to instantiate the driver class from > inside a class in the bundle (this makes the bundle packager to add > net.sourceforge.jdbc....... to the import package itself and when I tried > to start the bundle it says: > > The bundle could not be resolved. Reason: Missing Constraint: > Import-Package: net.sourceforge.jtds.jdbc; version="0.0.0" > > I have install the bundle this is the status below: > > [ 243] [Active ] [ ] [ ] [ 60] > file:d:\mssqlserver\jtds-1.2.2.jar > > I did headers 243 this is the the result: > > Bundle 243 > ---------- > 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,net.sourceforge.jtds.jdbc.Driver;version=" > 1.2.2" > Main-Class = net.sourceforge.jtds.jdbc.Driver > Class-Path = jcifs.jar > > This is quite strange. > > kr > > > > > > > Ashwin Karpe wrote: >> >> Hmm... >> >> I do not see it. Does the deployed jar contain the Driver class and does >> its status show as installed when you do osgi/list? >> >> Are there any other jars that the deployed jar depend on...? >> >> In your bundle manifest, did you set the version to 1.2? In any case you >> do not seem to mention a version in your application jar where you >> perform the import so it should pick up the latest version (1.2 in this >> case). >> >> This is curious... >> >> Cheers, >> >> Ashwin... >> >> >> >> lekkie wrote: >>> >>> I tried that and it still did not work. >>> >>> My import package lookslike: >>> >>> <Import-Package> >>> javax.jws,javax.wsdl, >>> META-INF.cxf, >>> META-INF.cxf.transport.nmr, >>> org.apache.cxf.bus, >>> org.apache.servicemix.camel.nmr, >>> org.apache.servicemix.cxf.transport.nmr, >>> org.apache.servicemix.nmr.api, >>> org.apache.servicemix.nmr.api.event, >>> org.apache.servicemix.nmr.api.internal, >>> org.springframework.beans.factory.config, >>> net.sourceforge.jtds.jdbc.Driver, >>> * >>> </Import-Package> >>> >>> I noticed my bundle's manifest has the version has 1.2 instead of 1.2.2, >>> see manifest below: >>> >>> META-INF.cxf,META-INF.cxf.transport.nmr,com.mchange. >>> v2.c3p0,javax.jws,javax.wsdl,javax.xml.bind,javax.xml.bind.annotation >>> ,javax.xml.parsers,net.sourceforge.jtds.jdbc.Driver;version="1.2",org >>> .apache.camel;version="2.0",org.apache.commons.logging,org.apache.cxf >>> .bus,org.apache.servicemix.camel.nmr,org.apache.servicemix.cxf.transp >>> ort.nmr,org.apache.servicemix.nmr.api,org.apache.servicemix.nmr.api.e >>> vent,org.apache.servicemix.nmr.api.internal,org.springframework.beans >>> .factory.config,org.w3c.dom,org.xml.sax >>> >>> >>> >>> >>> Ashwin Karpe wrote: >>>> >>>> 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-tp27544168p27563372.html Sent from the Camel - Users mailing list archive at Nabble.com.
