我在Camel中有一个现有的路由,它有一个连接到mssql服务器的jdbc端点。这很好。
现在我想切换到apache servicemix以使用该热点蓝图部署' -feature。
我使用的下载: http://www.apache.org/dyn/closer.lua/servicemix/servicemix-6/6.1.0/apache-servicemix-6.1.0.zip。
我在servicemix.bat启动后所做的安装:
我想使用jtds驱动程序,所以我也做了:
希望这是正确的......
以下是我复制到deploy文件夹的blueprint-xml:
<?xml version="1.0" encoding="UTF-8"?>
<blueprint
xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd">
<bean id="myDataSource" class="org.springframework.jdbc.datasource.SimpleDriverDataSource">
<property name="driverClass" value="net.sourceforge.jtds.jdbc.Driver"/>
<property name="url" value="jdbc:jtds:sqlserver://theserver:1433/thedbname;user=theuser;password=thepass"/>
</bean>
<camelContext xmlns="http://camel.apache.org/schema/blueprint">
<route id="db">
<from uri="file://c:/tmp/camel/in"/>
<setBody>
<simple>select count(*) from io</simple>
</setBody>
<to uri="jdbc:myDataSource" />
<to uri="file://c:/tmp/camel/out"/>
</route>
</camelContext>
</blueprint>
正如您所看到的那样,我只想计算名为&#39; io&#39;的表中的行数。当文件到达文件夹时。结果应写入另一个文件夹。
这里是复制后日志文件的内容:
2015-12-07 13:42:15,535 | INFO | mix-6.1.0/deploy | fileinstall | 7 - org.apache.felix.fileinstall - 3.5.0 | Installing bundle mytest / 1.0.0
2015-12-07 13:42:16,417 | WARN | mix-6.1.0/deploy | DefaultTypeConverter | 199 - org.apache.camel.camel-core - 2.16.1 | Overriding type converter from: StaticMethodTypeConverter: public static org.apache.activemq.command.ActiveMQDestination org.apache.activemq.camel.converter.ActiveMQConverter.toDestination(java.lang.String) to: StaticMethodTypeConverter: public static org.apache.activemq.command.ActiveMQDestination org.apache.activemq.camel.converter.ActiveMQConverter.toDestination(java.lang.String)
2015-12-07 13:42:16,418 | WARN | mix-6.1.0/deploy | DefaultTypeConverter | 199 - org.apache.camel.camel-core - 2.16.1 | Overriding type converter from: InstanceMethodTypeConverter: public org.apache.activemq.command.ActiveMQMessage org.apache.activemq.camel.converter.ActiveMQMessageConverter.toMessage(org.apache.camel.Exchange) throws javax.jms.JMSException to: InstanceMethodTypeConverter: public org.apache.activemq.command.ActiveMQMessage org.apache.activemq.camel.converter.ActiveMQMessageConverter.toMessage(org.apache.camel.Exchange) throws javax.jms.JMSException
2015-12-07 13:42:16,418 | WARN | mix-6.1.0/deploy | DefaultTypeConverter | 199 - org.apache.camel.camel-core - 2.16.1 | Overriding type converter from: InstanceMethodTypeConverter: public org.apache.camel.Processor org.apache.activemq.camel.converter.ActiveMQMessageConverter.toProcessor(javax.jms.MessageListener) to: InstanceMethodTypeConverter: public org.apache.camel.Processor org.apache.activemq.camel.converter.ActiveMQMessageConverter.toProcessor(javax.jms.MessageListener)
2015-12-07 13:42:16,438 | INFO | mix-6.1.0/deploy | BlueprintContainerImpl | 15 - org.apache.aries.blueprint.core - 1.4.4 | Bundle mytest/1.0.0 is waiting for dependencies [(&(component=jdbc)(objectClass=org.apache.camel.spi.ComponentResolver))]
2015-12-07 13:42:16,441 | INFO | mix-6.1.0/deploy | fileinstall | 7 - org.apache.felix.fileinstall - 3.5.0 | Started bundle: blueprint:file:/C:/Program%20Files%20(x86)/apache-servicemix-6.1.0/deploy/mytest-1.0.0.xml
我认为原因在于:
Bundle mytest/1.0.0 is waiting for dependencies [(&(component=jdbc)(objectClass=org.apache.camel.spi.ComponentResolver))]
所以问题是:
你的时间。
答案 0 :(得分:2)
在Camel路由中使用jdbc时需要安装camel-jdbc
karaf@root>feature:install camel-jdbc
由于您只是将蓝图xml复制到deploy文件夹,因此您可能需要在其包ID上添加动态导入,因此请执行
osgi:list
在列表中找到包ID,然后
dev:dynamic-import <ID>
然后重启
osgi:restart <ID>
可能需要后者来允许您的蓝图xml文件加载jdbc驱动程序。