英文:
Not an ActiveMQ Artemis Destination exception4
问题
我有一个在 Jboss 7.0 服务器上运行的 Spring Java 应用程序。我正在尝试将其与 IBM MQ 适配器集成。我已经部署了 wmq.jmsra.rar 适配器,并按以下配置进行了配置:
<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
<resource-adapters>
<resource-adapter id="wmq.jmsra.rar">
<archive>
wmq.jmsra.rar
</archive>
<transaction-support>NoTransaction</transaction-support>
<connection-definitions>
<connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/exported/jms/MQConnectionFactory" tracking="false" pool-name="mq-my-app">
<config-property name="hostName">127.0.0.1</config-property>
<config-property name="port">1414</config-property>
<config-property name="channel">SYSTEM.ADMIN.SVRCONN</config-property>
<config-property name="transportType">CLIENT</config-property>
<config-property name="queueManager">MQ1</config-property>
<config-property name="username">admin</config-property>
<config-property name="password">passw0rd</config-property>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/exported/jms/MQRequestQueue" pool-name="queue-req">
<config-property name="baseQueueManagerName">MQ1</config-property>
<config-property name="baseQueueName">DEV.QUEUE.1</config-property>
</admin-object>
<admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/exported/jms/MQResponseQueue" pool-name="queue-res">
<config-property name="baseQueueManagerName">MQ1</config-property>
<config-property name="baseQueueName">DEV.QUEUE.2</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
</resource-adapters>
</subsystem>
我的 IBM 服务器在 Docker 上运行,并通过 localhost 地址访问。
在我的带有 Spring 上下文的 Java 应用程序中,在应用程序启动时,我通过 JNDI 访问 MQ 队列,并在尝试发送消息时遇到以下错误:
"java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bankAdapterImpl': Invocation of init method failed; nested exception is org.springframework.jms.InvalidDestinationException: Not an ActiveMQ Artemis Destination:com.ibm.mq.connector.outbound.MQQueueProxy@4d1be475; nested exception is javax.jms.InvalidDestinationException: Not an ActiveMQ Artemis Destination:com.ibm.mq.connector.outbound.MQQueueProxy@4d1be475
编辑:
我使用 JNDI 进行访问的方式:
public static final String CONNECTION_FACTORY_NAME = "jboss/exported/jms/MQConnectionFactory";
public static final String REQUEST_QUEUE_NAME = "jboss/exported/jms/MQRequestQueue";
...
Context jndiContext = new InitialContext();
return (Destination) jndiContext.lookup(REQUEST_QUEUE_NAME);
...
英文:
I have Java application with Spring that runs on Jboss server 7.0 . I'm trying to integrate it with IBM mq adapter I've deployed wmq.jmsra.rar adapter and configured it as follows:
<subsystem xmlns="urn:jboss:domain:resource-adapters:5.0">
<resource-adapters>
<resource-adapter id="wmq.jmsra.rar">
<archive>
wmq.jmsra.rar
</archive>
<transaction-support>NoTransaction</transaction-support>
<connection-definitions>
<connection-definition class-name="com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/exported/jms/MQConnectionFactory" tracking="false" pool-name="mq-my-app">
<config-property name="hostName">127.0.0.1</config-property>
<config-property name="port">1414</config-property>
<config-property name="channel">SYSTEM.ADMIN.SVRCONN</config-property>
<config-property name="transportType">CLIENT</config-property>
<config-property name="queueManager">MQ1</config-property>
<config-property name="username">admin</config-property>
<config-property name="password">passw0rd</config-property>
</connection-definition>
</connection-definitions>
<admin-objects>
<admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/exported/jms/MQRequestQueue" pool-name="queue-req">
<config-property name="baseQueueManagerName">MQ1</config-property>
<config-property name="baseQueueName">DEV.QUEUE.1</config-property>
</admin-object>
<admin-object class-name="com.ibm.mq.connector.outbound.MQQueueProxy" jndi-name="java:jboss/exported/jms/MQResponseQueue" pool-name="queue-res">
<config-property name="baseQueueManagerName">MQ1</config-property>
<config-property name="baseQueueName">DEV.QUEUE.2</config-property>
</admin-object>
</admin-objects>
</resource-adapter>
</resource-adapters>
</subsystem>
My IBM Server runs on docker and is acessed by localhost address.
In my java app with Spring context I'm accessing mq queues by jndi on app startup and when I'm trying to send message I get following error:
"java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'bankAdapterImpl': Invocation of init method failed; nested exception is org.springframework.jms.InvalidDestinationException: Not an ActiveMQ Artemis Destination:com.ibm.mq.connector.outbound.MQQueueProxy@4d1be475; nested exception is javax.jms.InvalidDestinationException: Not an ActiveMQ Artemis Destination:com.ibm.mq.connector.outbound.MQQueueProxy@4d1be475
Edit:
The way I'm accessing with jndi
public static final String CONNECTION_FACTORY_NAME = "jboss/exported/jms/MQConnectionFactory";
public static final String REQUEST_QUEUE_NAME = "jboss/exported/jms/MQRequestQueue";
...
Context jndiContext = new InitialContext();
return (Destination) jndiContext.lookup(REQUEST_QUEUE_NAME);
...
答案1
得分: 0
好的,我知道出了什么问题,我使用了另一个JMS模板对象,该对象使用了默认的Artemis Mq客户端,而不是我通过JNDI访问的那个对象。
英文:
Okay I got what was wrong, I was using another jms template object that was using default Artemis Mq client instead of the one I accessed by jndi.
专注分享java语言的经验与见解,让所有开发者获益!
评论