Apache camel 通过ServiceMix中的CamelRoute访问MSSQLserver
我在Camel中有一个现有路由,带有一个连接到mssql服务器的jdbc端点。那很好 现在我想切换到ApacheServiceMix来使用“热蓝图部署”功能 我使用的下载: 我在servicemix.bat启动后进行的安装:Apache camel 通过ServiceMix中的CamelRoute访问MSSQLserver,apache-camel,apache-karaf,apache-servicemix,Apache Camel,Apache Karaf,Apache Servicemix,我在Camel中有一个现有路由,带有一个连接到mssql服务器的jdbc端点。那很好 现在我想切换到ApacheServiceMix来使用“热蓝图部署”功能 我使用的下载: 我在servicemix.bat启动后进行的安装: <?xml version="1.0" encoding="UTF-8"?> <blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0" xmlns:xsi="http://w
<?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>
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))]
- karaf@root>特点:安装驼峰码头
- karaf@root>功能:安装SpringJDBC
- karaf@root>功能:安装jdbc
- karaf@root>功能:安装webconsole
<?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>
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))]
- karaf@root>安装-s wrap:mvn:net.sourceforge.jtds/jtds/1.3.1
<?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>
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))]
我想原因就在这里:
<?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>
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))]
所以问题是:
<?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>
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))]
- 这是什么意思
- 如何解决这个问题
谢谢您的时间。您需要在驼峰路线中使用jdbc时安装驼峰jdbc
karaf@root>feature:install camel-jdbc
而且,由于您只是将blueprint xml复制到deploy文件夹中,因此可能需要在其bundle id上添加动态导入,所以请执行以下操作:
osgi:list
并在列表中找到bundle id,然后
dev:dynamic-import <ID>
dev:动态导入
然后重新启动它
osgi:restart <ID>
osgi:重新启动
后者可能需要允许blueprint xml文件加载jdbc驱动程序。
功能:安装camel jdbc
完成了,thx<代码>osgi:list不起作用,但list起作用。对于dev:dynamic import
,dynamic import
也一样。在我的环境中也不需要重新启动。然而,它现在起作用了。又是thx。是的,karaf命令在较新的版本中发生了变化,因此我认为它是捆绑的,而不是osgi等。如果没有名称冲突,您可以在没有前缀的情况下运行该命令,因此它们可能会工作