我在将一个JDBC驱动程序JTDS注册到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命令以安装驱动程序;
osgi:install -s wrap:mvn:net.sourceforge/jtds/1.3.1
osgi:install -s wrap:mvn:jcifs/jcifs/1.3.17
如果我显示jtds的导出,我得到:
JBossFuse:karaf @根&GT; 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"
对于JDSFS,这是JTDS所要求的
JBossFuse:karaf @根&GT; osgi:标题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
现在,对于我已经部署的捆绑包,我已经列出了导入,(我已经强调了JTDS的导入,因此,这来自POM设置):
JBossFuse:karaf @根&GT;包:进口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**
我的捆绑部署正常: [282] [主动] [] [开始] [60] rest.proxy(0.0.1.SNAPSHOT)
但是当我点击Camel(JAX-RS消费者)公开的其他代理时,它必须进行数据库查找。我收到这个错误:
引起:java.sql.SQLException:找不到合适的驱动程序 jdbc:jtds:sqlserver:// ?????; databaseName = ?????; tds = 8.0; lastupdatecount = true
现在,我不是OSGI的专家,过去曾经使用过一段时间。对于我做错的事,我看不出任何明显的东西。
我已经完成了一些早期的错误并通过确保JAR导出正确的包来修复它们,并且导入包放在我的Bundle上。
任何帮助非常感谢。
答案 0 :(得分:1)
您可能会发现直接在spring bean中实例化JTDS数据源更容易。 这里有一个简单的例子http://fusesource.com/forums/thread.jspa?threadID=1682
绝对可以运行JTDS 1.2x和bonecp,对于连接池
非常有用