不是ActiveMQ Artemis目标异常4

huangapple 未分类评论50阅读模式
英文:

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:

&lt;subsystem xmlns=&quot;urn:jboss:domain:resource-adapters:5.0&quot;&gt;
            &lt;resource-adapters&gt;
                &lt;resource-adapter id=&quot;wmq.jmsra.rar&quot;&gt;
                    &lt;archive&gt;
                        wmq.jmsra.rar
                    &lt;/archive&gt;
                    &lt;transaction-support&gt;NoTransaction&lt;/transaction-support&gt;
                    &lt;connection-definitions&gt;
                        &lt;connection-definition class-name=&quot;com.ibm.mq.connector.outbound.ManagedConnectionFactoryImpl&quot; jndi-name=&quot;java:jboss/exported/jms/MQConnectionFactory&quot; tracking=&quot;false&quot; pool-name=&quot;mq-my-app&quot;&gt;
                            &lt;config-property name=&quot;hostName&quot;&gt;127.0.0.1&lt;/config-property&gt;
                            &lt;config-property name=&quot;port&quot;&gt;1414&lt;/config-property&gt;
                            &lt;config-property name=&quot;channel&quot;&gt;SYSTEM.ADMIN.SVRCONN&lt;/config-property&gt;
                            &lt;config-property name=&quot;transportType&quot;&gt;CLIENT&lt;/config-property&gt;
                            &lt;config-property name=&quot;queueManager&quot;&gt;MQ1&lt;/config-property&gt;
                            &lt;config-property name=&quot;username&quot;&gt;admin&lt;/config-property&gt;
                            &lt;config-property name=&quot;password&quot;&gt;passw0rd&lt;/config-property&gt;
                        &lt;/connection-definition&gt;
                    &lt;/connection-definitions&gt;
                    &lt;admin-objects&gt;
                        &lt;admin-object class-name=&quot;com.ibm.mq.connector.outbound.MQQueueProxy&quot; jndi-name=&quot;java:jboss/exported/jms/MQRequestQueue&quot; pool-name=&quot;queue-req&quot;&gt;
                            &lt;config-property name=&quot;baseQueueManagerName&quot;&gt;MQ1&lt;/config-property&gt;
                            &lt;config-property name=&quot;baseQueueName&quot;&gt;DEV.QUEUE.1&lt;/config-property&gt;
                        &lt;/admin-object&gt;
                        &lt;admin-object class-name=&quot;com.ibm.mq.connector.outbound.MQQueueProxy&quot; jndi-name=&quot;java:jboss/exported/jms/MQResponseQueue&quot; pool-name=&quot;queue-res&quot;&gt;
                            &lt;config-property name=&quot;baseQueueManagerName&quot;&gt;MQ1&lt;/config-property&gt;
                            &lt;config-property name=&quot;baseQueueName&quot;&gt;DEV.QUEUE.2&lt;/config-property&gt;
                        &lt;/admin-object&gt;
                    &lt;/admin-objects&gt;
                &lt;/resource-adapter&gt;
            &lt;/resource-adapters&gt;
        &lt;/subsystem&gt;

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:

&quot;java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name &#39;bankAdapterImpl&#39;: 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 = &quot;jboss/exported/jms/MQConnectionFactory&quot;;

 public static final String REQUEST_QUEUE_NAME = &quot;jboss/exported/jms/MQRequestQueue&quot;;

...
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.

huangapple
  • 本文由 发表于 2020年6月29日 14:53:04
  • 转载请务必保留本文链接:https://java.coder-hub.com/62632702.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定