简体   繁体   English

使用Apache骆驼的Jms Connection

[英]Jms Connection using Apache camel

I am trying to establish connection with JMS using Apache Camel , the server is using Jnp protocol. 我正在尝试使用Apache Camel建立与JMS的连接,服务器正在使用Jnp协议。 But i am getting exceptions while trying that. 但是我在尝试时遇到了例外。 Need help , if i am missing anything or doing something wrong. 如果我缺少任何东西或做错了事,需要帮助。 I have the JMS API jar dependency in the pom. 我在pom中具有JMS API jar依赖项。

Technology Stack : 技术栈:

  • Jboss Fuse 6.3 Jboss保险丝6.3
  • Apache Camel(for Integration) Apache Camel(用于集成)

Blueprint : 蓝图:

<bean class="org.springframework.jndi.JndiTemplate" 
 id="remoteJndiTemplate">
    <property name="environment">
        <props>
            <prop key="java.naming.provider.url">jnp://x.x.x.x:yyyy</prop>
            <prop key="java.naming.factory.url.pkgs">org.jnp.interfaces:org.jboss.naming</prop>
            <prop key="java.naming.factory.initial">org.jnp.interfaces.NamingContextFactory</prop>
        </props>
    </property>
</bean>
<bean class="org.springframework.jndi.JndiObjectFactoryBean"
    id="remoteConnectionFactory" init-method="afterPropertiesSet">
    <property name="jndiTemplate" ref="remoteJndiTemplate"/>
    <property name="jndiName" value="ConnectionFactory"/>
    <property name="lookupOnStartup" value="false"/>
    <!-- <property name="proxyInterface" value="javax.jms.QueueConnectionFactory"/> -->
    <property name="expectedType" value="javax.jms.QueueConnectionFactory"/>
</bean>
<bean factory-method="getObject"
    factory-ref="remoteConnectionFactory" id="jmsInConnectionFactory"/>
<bean class="org.apache.camel.component.jms.JmsComponent" id="jmsComponent">
    <property name="configuration">
        <bean class="org.apache.camel.component.jms.JmsConfiguration">
            <property name="connectionFactory" ref="jmsInConnectionFactory"/>
        </bean>
    </property>
</bean> 

Exception : 例外情况:

org.osgi.service.blueprint.container.ComponentDefinitionException: Unable to initialize bean remoteConnectionFactory
Caused by: java.lang.IllegalArgumentException: interface javax.jms.QueueConnectionFactory is not visible from class loader

jnp is JNDI naming service used in JBoss". I think below test case can help you further. activemq-unit using spring JNDI jnp是JBoss中使用的JNDI命名服务。”我认为下面的测试案例可以为您提供进一步的帮助。 使用spring JNDI的activemq-unit

Regarding 关于

java.lang.IllegalArgumentException: interface javax.jms.QueueConnectionFactory is not visible from class loader java.lang.IllegalArgumentException:接口javax.jms.QueueConnectionFactory从类加载器中不可见

this looks like different issue. 这看起来像另外一个问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM