0

I'm having some difficulty registering a JDBC driver, JTDS, into FUSE.

routes.xml

  <bean id="myDS" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName" value="net.sourceforge.jtds.jdbc.Driver"/>
    <property name="url" value="jdbc:jtds:sqlserver://?????;databaseName=?????;tds=8.0;lastupdatecount=true" />
    <property name="username" value="fuser" />
    <property name="password" value="fuser" />
  </bean>

pom.xml

<build>
    <plugins>
      <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>2.3.4</version>
        <extensions>true</extensions>
        <configuration>
          <instructions>
            <Bundle-SymbolicName>rest.proxy</Bundle-SymbolicName>
            <Require-Bundle>org.apache.cxf.bundle,org.apache.camel.camel-cxf,org.springframework.beans</Require-Bundle>
            <Import-Package>net.sourceforge.jtds.jdbc,*</Import-Package>
          </instructions>
        </configuration>
      </plugin>
    </plugins>
  </build>

Fuse commands run to install drivers;

osgi:install -s wrap:mvn:net.sourceforge/jtds/1.3.1 

osgi:install -s wrap:mvn:jcifs/jcifs/1.3.17 

If I show exports for jtds I get:

JBossFuse:karaf@root> osgi:headers 278

wrap_mvn_net.sourceforge_jtds_1.3.1 (278) 

Main-Class = net.sourceforge.jtds.jdbc.Driver 
Specification-Title = JDBC 
Tool = Bnd-0.0.357 
Specification-Version = 3.0 
Implementation-Version = 1.3.1 
Generated-By-Ops4j-Pax-From = wrap:mvn:net.sourceforge/jtds/1.3.1 
Created-By = 1.7.0_25 (Oracle Corporation) 
Implementation-Title = jTDS JDBC Driver 
Manifest-Version = 1.0 
Bnd-LastModified = 1381480171800 
Implementation-URL = http://jtds.sourceforge.net
Originally-Created-By = 1.7.0_21-b11 (Oracle Corporation) 
Ant-Version = Apache Ant 1.8.2 


Bundle-Name = wrap_mvn_net.sourceforge_jtds_1.3.1 
Bundle-SymbolicName = wrap_mvn_net.sourceforge_jtds_1.3.1 
Bundle-Version = 0 
Bundle-ManifestVersion = 2 


Import-Package = 
        javax.crypto;resolution:=optional, 
        javax.crypto.spec;resolution:=optional, 
        javax.naming;resolution:=optional, 
        javax.naming.spi;resolution:=optional, 
        javax.net;resolution:=optional, 
        javax.net.ssl;resolution:=optional, 
        javax.sql;resolution:=optional, 
        javax.transaction.xa;resolution:=optional, 
        jcifs;resolution:=optional, 
        jcifs.smb;resolution:=optional, 
        net.sourceforge.jtds.jdbc;resolution:=optional, 
        net.sourceforge.jtds.jdbc.cache;resolution:=optional, 
        net.sourceforge.jtds.jdbcx;resolution:=optional, 
        net.sourceforge.jtds.jdbcx.proxy;resolution:=optional, 
        net.sourceforge.jtds.ssl;resolution:=optional, 
        net.sourceforge.jtds.util;resolution:=optional, 
        org.ietf.jgss;resolution:=optional 
Export-Package = 
        **net.sourceforge.jtds.jdbc**; 
                uses:="net.sourceforge.jtds.util, 
                        net.sourceforge.jtds.jdbc.cache, 
                        jcifs.smb, 
                        jcifs, 
                        javax.net, 
                        net.sourceforge.jtds.ssl, 
                        org.ietf.jgss, 
                        net.sourceforge.jtds.jdbcx, 
                        javax.transaction.xa", 
        net.sourceforge.jtds.jdbc.cache;uses:=net.sourceforge.jtds.jdbc, 
        net.sourceforge.jtds.jdbcx; 
                uses:="javax.naming, 
                        javax.sql, 
                        net.sourceforge.jtds.util, 
                        net.sourceforge.jtds.jdbc, 
                        javax.naming.spi, 
                        javax.transaction.xa, 
                        net.sourceforge.jtds.jdbcx.proxy", 
        net.sourceforge.jtds.jdbcx.proxy;uses:="net.sourceforge.jtds.jdbc,net.sourceforge.jtds.jdbcx", 
        net.sourceforge.jtds.ssl;uses:="javax.net.ssl,javax.net,net.sourceforge.jtds.util", 
        net.sourceforge.jtds.util;uses:="net.sourceforge.jtds.jdbc,javax.crypto.spec,javax.crypto" 

And for JCIFS, which is required by JTDS

JBossFuse:karaf@root> osgi:headers 283

wrap_mvn_jcifs_jcifs_1.3.17 (283) 


Manifest-Version = 1.0 
Bnd-LastModified = 1381486791455 
Archiver-Version = Plexus Archiver 
Tool = Bnd-0.0.357 
Originally-Created-By = Apache Maven 
Built-By = ajvanerp 
Generated-By-Ops4j-Pax-From = wrap:mvn:jcifs/jcifs/1.3.17 
Build-Jdk = 1.6.0_29 
Created-By = 1.7.0_25 (Oracle Corporation) 


Bundle-Name = wrap_mvn_jcifs_jcifs_1.3.17 
Bundle-SymbolicName = wrap_mvn_jcifs_jcifs_1.3.17 
Bundle-Version = 0 
Bundle-ManifestVersion = 2 


Import-Package = 
        javax.servlet;resolution:=optional, 
        javax.servlet.http;resolution:=optional, 
        jcifs;resolution:=optional, 
        jcifs.dcerpc;resolution:=optional, 
        jcifs.dcerpc.msrpc;resolution:=optional, 
        jcifs.dcerpc.ndr;resolution:=optional, 
        jcifs.http;resolution:=optional, 
        jcifs.https;resolution:=optional, 
        jcifs.netbios;resolution:=optional, 
        jcifs.ntlmssp;resolution:=optional, 
        jcifs.smb;resolution:=optional, 
        jcifs.util;resolution:=optional, 
        jcifs.util.transport;resolution:=optional 
Export-Package = 
        jcifs;uses:="jcifs.util,jcifs.netbios", 
        jcifs.dcerpc;uses:="jcifs.util,jcifs.dcerpc.ndr,jcifs.dcerpc.msrpc,jcifs.smb", 
        jcifs.dcerpc.msrpc;uses:="jcifs.smb,jcifs.dcerpc,jcifs.dcerpc.ndr", 
        jcifs.dcerpc.ndr;uses:=jcifs.util, 
        jcifs.http;uses:="javax.servlet,jcifs.util,jcifs.smb,jcifs,jcifs.netbios,javax.servlet.http,jcifs.ntlmssp", 
        jcifs.https;uses:=jcifs.http, 
        jcifs.netbios;uses:="jcifs.util,jcifs.smb,jcifs", 
        jcifs.ntlmssp;uses:="jcifs,jcifs.util,jcifs.netbios,jcifs.smb", 
        jcifs.smb;uses:="jcifs.util,jcifs,jcifs.ntlmssp,jcifs.dcerpc.msrpc,jcifs.dcerpc.ndr,jcifs.dcerpc,jcifs.util.transport,jcifs.netbios", 
        jcifs.util, 
        jcifs.util.transport;uses:=jcifs.util 

Now, for my bundle that I have deployed I have listed the imports, (I've hightlighted the import of JTDS, so, this has come from the POM setting):

JBossFuse:karaf@root> packages:imports 282

System Bundle (0): javax.xml.bind.annotation; version=2.2.1 
Spring Beans (105): org.springframework.beans; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.annotation; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory.access; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory.access.el; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory.annotation; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory.config; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory.parsing; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory.serviceloader; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory.support; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory.wiring; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.factory.xml; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.propertyeditors; version=3.1.3.RELEASE 
Spring Beans (105): org.springframework.beans.support; version=3.1.3.RELEASE 
activemq-osgi (114): org.apache.activemq.camel.component; version=5.8.0.redhat-60024 
camel-core (130): org.apache.camel; version=2.10.0.redhat-60024 
Apache ServiceMix :: Specs :: JSR-311 API 1.1.1 (145): javax.ws.rs; version=1.1.1 
camel-cxf (194): org.apache.camel.component.cxf; version=2.10.0.redhat-60024 
camel-cxf (194): org.apache.camel.component.cxf.blueprint; version=2.10.0.redhat-60024 
camel-cxf (194): org.apache.camel.component.cxf.converter; version=2.10.0.redhat-60024 
camel-cxf (194): org.apache.camel.component.cxf.cxfbean; version=2.10.0.redhat-60024 
camel-cxf (194): org.apache.camel.component.cxf.feature; version=2.10.0.redhat-60024 
camel-cxf (194): org.apache.camel.component.cxf.interceptors; version=2.10.0.redhat-60024 
camel-cxf (194): org.apache.camel.component.cxf.jaxrs; version=2.10.0.redhat-60024 
camel-cxf (194): org.apache.camel.component.cxf.spring; version=2.10.0.redhat-60024 
camel-cxf (194): org.apache.camel.component.cxf.util; version=2.10.0.redhat-60024 
Spring JDBC (244): org.springframework.jdbc.datasource; version=3.1.3.RELEASE 
camel-sql (245): org.apache.camel.component.sql; version=2.10.0.redhat-60024 
**wrap_mvn_net.sourceforge_jtds_1.3.1 (278): net.sourceforge.jtds.jdbc; version=0.0.0** 

My bundle deploys fine: [ 282] [Active ] [ ] [Started] [ 60] rest.proxy (0.0.1.SNAPSHOT)

But when I hit the rest proxy exposed by Camel (JAX-RS consumer) it has to make a a database lookup. I get this error:

Caused by: java.sql.SQLException: No suitable driver found for jdbc:jtds:sqlserver://?????;databaseName=?????;tds=8.0;lastupdatecount=true

Now, I'm no expert on OSGI, having used it in the past a little for not for a while. I cannot see anything obvious to what I'm doing wrong.

I've gone through some earlier errors and fixed them by making sure the JARs export the right packages, and the Import package is put in on my Bundle.

Any help much appreciated.

рüффп
  • 5,172
  • 34
  • 67
  • 113
Skynet5
  • 63
  • 7

1 Answers1

1

You may find it easier to instantiate the JTDS data source directly within a spring bean. A quick example of this is available here http://fusesource.com/forums/thread.jspa?threadID=1682

It is definitely possible to run JTDS 1.2x and bonecp, useful for for connection pooling

AlanFoster
  • 8,156
  • 5
  • 35
  • 52