Java ApacheCammel JMS:“;不允许创建目的地“;尝试连接到队列时
我正在尝试在Camel中设置一个从JMS队列读取消息的路由 应用程序使用Tibco,我不允许在此发布任何数据,但工厂和队列的路径遵循格式/path/to/queueName:type,其中类型可以是qcf(队列连接工厂)和队列 我使用的是Spring DSL,XML是:Java ApacheCammel JMS:“;不允许创建目的地“;尝试连接到队列时,java,spring,jms,apache-camel,tibco,Java,Spring,Jms,Apache Camel,Tibco,我正在尝试在Camel中设置一个从JMS队列读取消息的路由 应用程序使用Tibco,我不允许在此发布任何数据,但工厂和队列的路径遵循格式/path/to/queueName:type,其中类型可以是qcf(队列连接工厂)和队列 我使用的是Spring DSL,XML是: <bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate"> <property name="environment"&g
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">...</prop>
<prop key="java.naming.provider.url">...LDAP Server URL...</prop>
<prop key="java.naming.referral">follow</prop>
<prop key="java.naming.security.credentials">...</prop>
<prop key="java.naming.security.principal">uid=...,ou=...,dc=...,dc=...</prop>
</props>
</property>
</bean>
<bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="/path/to/queueConnectionFactory:qcf"/>
</bean>
<bean id="authenticatedConnectionFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
<property name="targetConnectionFactory" ref="jmsQueueConnectionFactory"/>
<property name="username" value="..."/>
<property name="password" value="..."/>
</bean>
<bean id="testjms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="authenticatedConnectionFactory"/>
</bean>
<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
<route id="jmsRouteTest">
<from uri="testjms:queue:/path/to/queue:queue" />
<to uri="file:c:\inbox?fileName=jmsMessage.txt" />
</route>
</camelContext>
需要注意的一点是,目标的第一个斜杠“/”消失了,但如果我从URI中删除“queue:”则会发生相同的错误,但目标会变成“/path/to/queue:queue”
我已搜索此错误,并在stackoverflow上找到一个问题:
为了确保配置正确,我创建了以下类(将完全相同的设置从SpringXML复制到该类):
通过这个类,我能够读取队列中的消息
以前有人遇到过这个问题吗
如果你们需要更多信息,请告诉我
谢谢。听起来你需要一些Tibco管理员在Tibco消息代理上创建队列。听起来你需要一些Tibco管理员在Tibco消息代理上创建队列。听起来你需要一些Tibco管理员在Tibco消息代理上创建队列首先。听起来您需要一些Tibco管理员来首先在Tibco message broker上创建队列。谢谢您的帮助,但解决方案非常简单 我已经下载了要调试的源代码,并在名为DefaultMessageListenerContainer的Spring类中结束,在会话中调用createConsumer方法时引发了异常 这让我想到了春季论坛的一个话题 基本上,它说为了防止这个错误,应该使用JNDI来获取目标,而不是session.createQueue() 然后,我搜索了一种在端点URI中使用JNDI名称的方法,并找到了 这基本上说明需要一个目标解析器。添加它解决了错误
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop...</prop>
</props>
</property>
</bean>
<bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="..."/>
</bean>
<bean id="jmsDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="cache" value="true" />
</bean>
<bean id="testjms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsQueueConnectionFactory"/>
<property name="destinationResolver" ref="jmsDestinationResolver" />
</bean>
<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
<route id="testRoute">
<from uri="testjms:jmsJNDIName?connectionFactory=jmsQueueConnectionFactory&username=...&password=..." />
<to uri="file:C:\inbox" />
</route>
</camelContext>
谢谢你的帮助,但解决方法非常简单
我已经下载了要调试的源代码,并在名为DefaultMessageListenerContainer的Spring类中结束,在会话中调用createConsumer方法时引发了异常
这让我想到了春季论坛的一个话题
基本上,它说为了防止这个错误,应该使用JNDI来获取目标,而不是session.createQueue()
然后,我搜索了一种在端点URI中使用JNDI名称的方法,并找到了
这基本上说明需要一个目标解析器。添加它解决了错误
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop...</prop>
</props>
</property>
</bean>
<bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="..."/>
</bean>
<bean id="jmsDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="cache" value="true" />
</bean>
<bean id="testjms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsQueueConnectionFactory"/>
<property name="destinationResolver" ref="jmsDestinationResolver" />
</bean>
<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
<route id="testRoute">
<from uri="testjms:jmsJNDIName?connectionFactory=jmsQueueConnectionFactory&username=...&password=..." />
<to uri="file:C:\inbox" />
</route>
</camelContext>
谢谢你的帮助,但解决方法非常简单
我已经下载了要调试的源代码,并在名为DefaultMessageListenerContainer的Spring类中结束,在会话中调用createConsumer方法时引发了异常
这让我想到了春季论坛的一个话题
基本上,它说为了防止这个错误,应该使用JNDI来获取目标,而不是session.createQueue()
然后,我搜索了一种在端点URI中使用JNDI名称的方法,并找到了
这基本上说明需要一个目标解析器。添加它解决了错误
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop...</prop>
</props>
</property>
</bean>
<bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="..."/>
</bean>
<bean id="jmsDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="cache" value="true" />
</bean>
<bean id="testjms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsQueueConnectionFactory"/>
<property name="destinationResolver" ref="jmsDestinationResolver" />
</bean>
<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
<route id="testRoute">
<from uri="testjms:jmsJNDIName?connectionFactory=jmsQueueConnectionFactory&username=...&password=..." />
<to uri="file:C:\inbox" />
</route>
</camelContext>
谢谢你的帮助,但解决方法非常简单
我已经下载了要调试的源代码,并在名为DefaultMessageListenerContainer的Spring类中结束,在会话中调用createConsumer方法时引发了异常
这让我想到了春季论坛的一个话题
基本上,它说为了防止这个错误,应该使用JNDI来获取目标,而不是session.createQueue()
然后,我搜索了一种在端点URI中使用JNDI名称的方法,并找到了
这基本上说明需要一个目标解析器。添加它解决了错误
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate">
<property name="environment">
<props>
<prop...</prop>
</props>
</property>
</bean>
<bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiTemplate" ref="jndiTemplate"/>
<property name="jndiName" value="..."/>
</bean>
<bean id="jmsDestinationResolver" class="org.springframework.jms.support.destination.JndiDestinationResolver">
<property name="jndiTemplate" ref="jndiTemplate" />
<property name="cache" value="true" />
</bean>
<bean id="testjms" class="org.apache.camel.component.jms.JmsComponent">
<property name="connectionFactory" ref="jmsQueueConnectionFactory"/>
<property name="destinationResolver" ref="jmsDestinationResolver" />
</bean>
<camelContext id="camelContext" xmlns="http://camel.apache.org/schema/spring">
<route id="testRoute">
<from uri="testjms:jmsJNDIName?connectionFactory=jmsQueueConnectionFactory&username=...&password=..." />
<to uri="file:C:\inbox" />
</route>
</camelContext>
createQueue
方法的名称具有误导性。它并不打算实际创建队列本身,而只是引用一个已经存在的队列的queue
对象(请参阅)
JMS不提供任何API来创建(非临时)队列。这就是为什么您必须通过其他方法(通常是一些管理工具)创建队列,然后在JNDI中查找它
但是一些JMS提供者“滥用”了这种方法,在需要时自动创建队列,这使得它无法移植到其他JMS提供者。这仅仅是在JMS 2.0中允许的,createQueue
方法的名称具有误导性。它并不打算实际创建队列本身,而只是引用一个已经存在的队列的queue
对象(请参阅)
JMS不提供任何API来创建(非临时)队列。这就是为什么您必须通过其他方法(通常是一些管理工具)创建队列,然后在JNDI中查找它
但是一些JMS提供者“滥用”了这种方法,在需要时自动创建队列,这使得它无法移植到其他JMS提供者。这仅仅是在JMS 2.0中允许的,createQueue
方法的名称具有误导性。它并不打算实际创建队列本身,而只是引用一个已经存在的队列的queue
对象(请参阅)
JMS不提供任何API来创建(非临时)队列。这就是为什么您必须通过其他方法(通常是一些管理工具)创建队列,然后在JNDI中查找它
但是一些JMS提供者“误用”了这种方法,在需要时自动创建队列,从而使其不可移植