简体   繁体   中英

JBoss Fuse/REST DSL - Why do my modifications (to use IBM MQ) not work?

BACKGROUND: I assembled a "relatively" compact JBossFuse, REST-DSL example (from disparate posts/articles) that routes to an ActiveMQ queue (see working example, further below).

PROBLEM: I want to route to an "IBM MQ" queue, instead.

QUESTION: What has to change for me to route to "IBM MQ" instead of "ActiveMQ"?


I've tried the following...:

(A) building an IBM MQ "support bundle" and deploying it to Fuse and adding the dep. to the app's pom.xml

    <?xml version="1.0" encoding="UTF-8"?>
    <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
        <modelVersion>4.0.0</modelVersion>
        <groupId>com.ibm</groupId>
        <artifactId>ibm-mq-lib</artifactId>
        <version>9.0.0.0</version>
        <description>ibm-mq-lib</description>
        <packaging>bundle</packaging>

        <dependencies>
        <dependency>
            <groupId>com.ibm.mq.osgi</groupId>
            <artifactId>allclient</artifactId>
            <version>9.0.0.0</version>
            <systemPath>C:/tools/wmq/OSGi/com.ibm.mq.osgi.allclient_9.0.0.0.jar</systemPath>  
            <scope>system</scope>          
        </dependency>
        <dependency>
            <groupId>com.ibm.mq.osgi</groupId>        
            <artifactId>allclientprereqs</artifactId>
            <version>9.0.0.0</version>
            <systemPath>C:/tools/wmq/OSGi/com.ibm.mq.osgi.allclientprereqs_9.0.0.0.jar</systemPath>
            <scope>system</scope>             
        </dependency>
        <dependency>
            <groupId>com.ibm.mq</groupId>          
            <artifactId>allclient</artifactId>
            <version>9.0.0.0</version>
            <systemPath>C:/tools/wmq/JavaSE/com.ibm.mq.allclient.jar</systemPath>
            <scope>system</scope>             
        </dependency>  
        <dependency>
            <groupId>com.ibm.mq</groupId>        
            <artifactId>traceControl</artifactId>
            <version>9.0.0.0</version>
            <systemPath>C:/tools/wmq/JavaSE/com.ibm.mq.traceControl.jar</systemPath>
            <scope>system</scope>             
        </dependency>                     
        <dependency>
            <groupId>com.ibm.mq</groupId>       
            <artifactId>fscontext</artifactId>
            <version>9.0.0.0</version>
            <systemPath>C:/tools/wmq/JavaSE/fscontext.jar</systemPath>
            <scope>system</scope>             
        </dependency>             
        <dependency>
            <groupId>com.ibm.mq</groupId>       
            <artifactId>jms</artifactId>
            <version>9.0.0.0</version>
            <systemPath>C:/tools/wmq/JavaSE/jms.jar</systemPath>
            <scope>system</scope>             
        </dependency>         
        <dependency>
            <groupId>com.ibm.mq</groupId>        
            <artifactId>providerutil</artifactId>
            <version>9.0.0.0</version>
            <systemPath>C:/tools/wmq/JavaSE/providerutil.jar</systemPath>
            <scope>system</scope>             
        </dependency>                 
        </dependencies>
        <build>
        <plugins>
            <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>3.3.0</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                <Bundle-Name>${project.artifactId}</Bundle-Name>
                <Bundle-Description>description</Bundle-Description>
                <Bundle-Vendor>IBM MQ 9.0.0.0</Bundle-Vendor>
                <Import-Package></Import-Package>
                <Export-Package>*</Export-Package>
                <DynamicImport-Package>*</DynamicImport-Package>
                </instructions>
            </configuration>
            </plugin>
        </plugins>
        </build>
        <name>ibm-mq-lib</name>
    </project>

(B) modified the "camel-route.xml" file (added the following)

        ...

        <bean id="connectionFactory"
          class="com.ibm.mq.jms.MQConnectionFactory">
        <property name="transportType" value="1"/>
        <property name="hostName" value="localhost"/>
        <property name="port" value="1414"/>
        <property name="queueManager" value="QM1"/>
        <property name="channel" value="DEV.APP.SVRCONN" />    
        </bean>    
        <bean id="ibmMqConfig" class="org.apache.camel.component.jms.JmsConfiguration">
        <property name="connectionFactory" ref="connectionFactory"/>
        <property name="concurrentConsumers" value="10"/>    
        </bean>
        <bean id="ibmMq" 
          class="org.apache.camel.component.jms.JmsComponent">
        <property name="configuration" ref="ibmMqConfig"/>         
        </bean>
    </blueprint>

(C) modified "CamelRestRoutes.java" file to point to the IBM MQ queue (instead of the ActiveMQ queue)...

    ...
    from("direct:thingZ")
            .log("---------------------- (CCC) ----------------------> direct:thingZ...:" + body().toString())
            .to("ibmMq:queue:bubblegum?jmsMessageType=Text&exchangePattern=InOnly");  

Call the "getAll" method in the REST service results in an exception with the following log/exception output

    ...
                   WorkQueueMananger Contents
                   --------------------------

    |   Maintain ThreadPool size     :-  false
    |   Maximum ThreadPool size      :-  -1
    |   ThreadPool inactive timeout  :-  0
    |   unavailable -                :-  com.ibm.msg.client.commonservices.CSIException: JMSCS0002

                       Runtime properties
                       ------------------

    |   Available processors         :-  4
    |   Free memory in bytes (now)   :-  737153288
    |   Max memory in bytes          :-  954728448
    |   Total memory in bytes (now)  :-  875036672

                   Component Manager Contents
                   --------------------------

    Common Services Components:
    Messaging Provider Components:
    |   CMVC             :-  p900-L160512.4
    |   Class Name       :-  class com.ibm.msg.client.wmq.factories.WMQComponent
    |   Component Name   :-  com.ibm.msg.client.wmq
    |   Component Title  :-  IBM MQ JMS Provider
    |   Factory Class    :-  class com.ibm.msg.client.wmq.factories.WMQFactoryFactory
    |   Jar location     :-  bundle://530.0:1/com/ibm/msg/client/wmq/factories/WMQComponent.class
    |   Version          :-  9.0.0.0




                 Provider Specific Information
                 -----------------------------

    Overview of JMS System
    Num. Contexts    : 0
    Num. Connections : 0
    Num. Sessions    : 0
    Num. Consumers   : 0
    Num. Producers   : 0

    Detailed JMS System Information
    Contexts      :
    Connections      :
    Sessions         :
    Consumers        :
    Producers        :


    2017-08-08 09:44:57,407 | ERROR | estlet-672518929 | DefaultErrorHandler              | 232 - org.apache.camel.camel-core - 2.17.0.redhat-630187 | Failed delivery for (MessageId: ID-AAXA22A747-53217-1502199741603-0-3 on ExchangeId: ID-AAXA22A747-53217-1502199741603-0-2). Exhausted after delivery attempt: 1 caught: org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: null; nested exception is com.ibm.mq.MQException: JMSCMQ0001: JMSCMQ0001, 2, MQCC_FAILED, 2195, MQRC_UNEXPECTED_ERROR

    Message History
    ---------------------------------------------------------------------------------------------------------------------------------------
    RouteId              ProcessorId          Processor                                                                        Elapsed (ms)
    [route1            ] [route1            ] [http://localhost:8182/service/getAll?restletMethods=GET                       ] [      4126]
    [route1            ] [restBinding1      ] [                                                                              ] [         4]
    [route1            ] [route1            ] [direct:thingX                                                                 ] [      4119]
    [route2            ] [to1               ] [bean:camelRestService?method=getAll                                           ] [         7]
    [route2            ] [log1              ] [log                                                                           ] [         1]
    [route2            ] [to2               ] [direct:thingY                                                                 ] [      4110]
    [route3            ] [log2              ] [log                                                                           ] [         1]
    [route3            ] [to3               ] [direct:thingZ                                                                 ] [      4109]
    [route4            ] [log3              ] [log                                                                           ] [         0]
    [route4            ] [to4               ] [ibmMq:queue:mylocalqueue?jmsMessageType=Text&exchangePattern=InOnly           ] [      4109]

    Stacktrace
    ---------------------------------------------------------------------------------------------------------------------------------------
    org.springframework.jms.UncategorizedJmsException: Uncategorized exception occured during JMS processing; nested exception is com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: null; nested exception is com.ibm.mq.MQException: JMSCMQ0001: JMSCMQ0001, 2, MQCC_FAILED, 2195, MQRC_UNEXPECTED_ERROR
        at org.springframework.jms.support.JmsUtils.convertJmsAccessException(JmsUtils.java:316)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
        at org.springframework.jms.support.JmsAccessor.convertJmsAccessException(JmsAccessor.java:168)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:469)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
        at org.apache.camel.component.jms.JmsConfiguration$CamelJmsTemplate.send(JmsConfiguration.java:452)[244:org.apache.camel.camel-jms:2.17.0.redhat-630187]
        at org.apache.camel.component.jms.JmsProducer.doSend(JmsProducer.java:414)[244:org.apache.camel.camel-jms:2.17.0.redhat-630187]
        at org.apache.camel.component.jms.JmsProducer.processInOnly(JmsProducer.java:368)[244:org.apache.camel.camel-jms:2.17.0.redhat-630187]
        at org.apache.camel.component.jms.JmsProducer.process(JmsProducer.java:154)[244:org.apache.camel.camel-jms:2.17.0.redhat-630187]
        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.component.direct.DirectProducer.process(DirectProducer.java:62)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.SendProcessor.process(SendProcessor.java:145)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.management.InstrumentationProcessor.process(InstrumentationProcessor.java:77)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:468)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:121)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.Pipeline.process(Pipeline.java:83)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:196)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.util.AsyncProcessorHelper.process(AsyncProcessorHelper.java:109)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:91)[232:org.apache.camel.camel-core:2.17.0.redhat-630187]
        at org.apache.camel.component.restlet.RestletConsumer$1.handle(RestletConsumer.java:68)[304:org.apache.camel.camel-restlet:2.17.0.redhat-630187]
        at org.apache.camel.component.restlet.MethodBasedRouter.handle(MethodBasedRouter.java:54)[304:org.apache.camel.camel-restlet:2.17.0.redhat-630187]
        at org.restlet.routing.Filter.doHandle(Filter.java:150)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Filter.handle(Filter.java:197)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Router.doHandle(Router.java:422)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Router.handle(Router.java:639)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Filter.doHandle(Filter.java:150)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Filter.handle(Filter.java:197)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Router.doHandle(Router.java:422)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Router.handle(Router.java:639)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Filter.doHandle(Filter.java:150)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.engine.application.StatusFilter.doHandle(StatusFilter.java:140)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Filter.handle(Filter.java:197)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Filter.doHandle(Filter.java:150)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.routing.Filter.handle(Filter.java:197)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.engine.CompositeHelper.handle(CompositeHelper.java:202)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.Component.handle(Component.java:408)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.Server.handle(Server.java:507)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.engine.connector.ServerHelper.handle(ServerHelper.java:63)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.engine.adapter.HttpServerHelper.handle(HttpServerHelper.java:143)[303:org.restlet:2.3.6.v20160126-1627]
        at org.restlet.engine.connector.HttpServerHelper$1.handle(HttpServerHelper.java:64)[303:org.restlet:2.3.6.v20160126-1627]
        at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)[:1.8.0_131]
        at sun.net.httpserver.AuthFilter.doFilter(AuthFilter.java:83)[:1.8.0_131]
        at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:82)[:1.8.0_131]
        at sun.net.httpserver.ServerImpl$Exchange$LinkHandler.handle(ServerImpl.java:675)[:1.8.0_131]
        at com.sun.net.httpserver.Filter$Chain.doFilter(Filter.java:79)[:1.8.0_131]
        at sun.net.httpserver.ServerImpl$Exchange.run(ServerImpl.java:647)[:1.8.0_131]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)[:1.8.0_131]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)[:1.8.0_131]
        at java.lang.Thread.run(Thread.java:748)[:1.8.0_131]
    Caused by: com.ibm.msg.client.jms.DetailedJMSException: JMSWMQ0018: null
        at com.ibm.msg.client.wmq.common.internal.Reason.reasonToException(Reason.java:595)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:215)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:422)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createV7ProviderConnection(WMQConnectionFactory.java:8475)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.msg.client.wmq.factories.WMQConnectionFactory.createProviderConnection(WMQConnectionFactory.java:7814)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl._createConnection(JmsConnectionFactoryImpl.java:299)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.msg.client.jms.admin.JmsConnectionFactoryImpl.createConnection(JmsConnectionFactoryImpl.java:236)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jms.MQConnectionFactory.createCommonConnection(MQConnectionFactory.java:6024)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jms.MQConnectionFactory.createConnection(MQConnectionFactory.java:6049)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at org.springframework.jms.support.JmsAccessor.createConnection(JmsAccessor.java:184)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
        at org.springframework.jms.core.JmsTemplate.execute(JmsTemplate.java:456)[243:org.apache.servicemix.bundles.spring-jms:3.2.16.RELEASE_2]
        ... 67 more
    Caused by: com.ibm.mq.MQException: JMSCMQ0001: JMSCMQ0001, 2, MQCC_FAILED, 2195, MQRC_UNEXPECTED_ERROR
        at com.ibm.msg.client.wmq.common.internal.Reason.createException(Reason.java:203)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        ... 76 more
    Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195;AMQ9204: Connection to host 'localhost(1414)' rejected. [1=com.ibm.mq.jmqi.JmqiException[CC=2;RC=2195],3=localhost(1414),5=JmqiDefaultThreadPool.enqueue]
        at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:2280)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1285)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.msg.client.wmq.internal.WMQConnection.<init>(WMQConnection.java:355)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        ... 75 more
    Caused by: com.ibm.mq.jmqi.JmqiException: CC=2;RC=2195
        at com.ibm.mq.jmqi.JmqiDefaultThreadPool.enqueue(JmqiDefaultThreadPool.java:97)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jmqi.remote.impl.RemoteConnection.setUpAsyncMode(RemoteConnection.java:1979)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jmqi.remote.impl.RemoteConnection.initSess(RemoteConnection.java:1741)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jmqi.remote.impl.RemoteConnection.connect(RemoteConnection.java:863)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSessionFromNewConnection(RemoteConnectionSpecification.java:409)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jmqi.remote.impl.RemoteConnectionSpecification.getSession(RemoteConnectionSpecification.java:305)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jmqi.remote.impl.RemoteConnectionPool.getSession(RemoteConnectionPool.java:146)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jmqi.remote.api.RemoteFAP.jmqiConnect(RemoteFAP.java:1721)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        ... 77 more
    Caused by: com.ibm.msg.client.commonservices.CSIException: JMSCS0002
        at com.ibm.msg.client.commonservices.workqueue.PIWorkQueueManager.enqueueItem(PIWorkQueueManager.java:55)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.enqueue(WorkQueueManager.java:232)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.msg.client.commonservices.workqueue.WorkQueueManager.enqueue(WorkQueueManager.java:200)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        at com.ibm.mq.jmqi.JmqiDefaultThreadPool.enqueue(JmqiDefaultThreadPool.java:79)[530:com.ibm.mq.osgi.allclient:9.0.0.0]
        ... 84 more
    2017-08-08 09:44:57,429 | INFO  | estlet-672518929 | LogService                       | 303 - org.restlet - 2.3.6.v20160126-1627 | 2017-08-08   09:44:57        0:0:0:0:0:0:0:1 -       -       8182    GET     /service/getAll/        -       500     8856    0       4140    http://localhost:8182   Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:55.0) Gecko/20100101 Firefox/55.0  -

For comparison/context, BELOW, is the working project that routes to an ActiveMQ queue...

Here is the project structure

camelRest 项目结构

aaa.bbb.ccc.CamelRestService.java

package aaa.bbb.ccc;

import aaa.bbb.ccc.model.CamelRestPojo;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.MediaType;

@Path("/service/")
public class CamelRestService {
    Map<Long, CamelRestPojo> itemMap = new HashMap<>();
    public CamelRestService() {
    init();
    }
    @GET
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})  
    @Path("/getAll/")
    public Collection<CamelRestPojo> getAll() {
    return itemMap.values();
    }

    final void init() {
    CamelRestPojo o = new CamelRestPojo();
    o.setName("JOE BLOW");
    o.setId(100);
    itemMap.put(o.getId(), o);
    }
}

aaa.bbb.ccc.CamelRestRoute.java

package aaa.bbb.ccc;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestBindingMode;

public class CamelRestRoutes extends RouteBuilder {

    public CamelRestRoutes() {
    }

    @Override
    public void configure() throws Exception {
    restConfiguration().component("restlet")
        .host("localhost")
        .port(8182)
        .bindingMode(RestBindingMode.json_xml);

    rest("/service")
        .bindingMode(RestBindingMode.json_xml)
        .get("/getAll")
        .produces("application/json")
        .to("direct:thingX");

    from("direct:thingX")
        .to("bean:camelRestService?method=getAll")
        .log("---------------------- (AAA) ----------------------> direct:thingX...:" + body().toString())
        .to("direct:thingY");

    from("direct:thingY")
        .log("---------------------- (BBB) ----------------------> direct:thingY...:" + body().toString())
        .to("direct:thingZ");
    from("direct:thingZ")
        .log("---------------------- (CCC) ----------------------> direct:thingZ...:" + body().toString())
        .to("activemq:queue:bubblegum?jmsMessageType=Text&exchangePattern=InOnly");
    }
}

aaa.bbb.ccc.model.CamelRestPojo.java

package aaa.bbb.ccc.model;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement(name = "camelRestPojo")
public class CamelRestPojo implements Serializable {
    @XmlElement
    private long id;
    @XmlElement
    private String name;
    public long getId() {
    return id;
    }
    public void setId(long id) {
    this.id = id;
    }
    public String getName() {
    return name;
    }
    public void setName(String name) {
    this.name = name;
    }
    @Override
    public String toString() {
    return "CamelRestPojo{" + "id=" + id + ", name=" + name + '}';
    }
}

camel-route.xml

<?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"
       xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
       xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
       xmlns:camel="http://camel.apache.org/schema/blueprint"
       xsi:schemaLocation="
         http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
         http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
         http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
         ">
    <camel:camelContext id="aaa.bbb.ccc.routing.poc" xmlns="http://camel.apache.org/schema/blueprint">
    <packageScan>
        <package>aaa.bbb.ccc</package>
    </packageScan>
    </camel:camelContext>
    <bean id="camelRestService" class="aaa.bbb.ccc.CamelRestService"/> 
    <bean id = "activemq" class = "org.apache.activemq.camel.component.ActiveMQComponent">
    <property name = "brokerURL" value = "tcp://localhost:61616"/>
    <property name = "userName" value = "admin"/>
    <property name = "password" value = "admin"/>
    </bean>
</blueprint>

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>aaa.bbb.ccc</groupId>
    <artifactId>camelRest</artifactId>
    <version>1</version>
    <packaging>bundle</packaging>
    <name>camelRest</name>
    <description>camelRest</description>
    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <skipTests>true</skipTests>
    </properties>
    <dependencies>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>2.17.0</version>
        <scope>provided</scope>
    </dependency>           
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-restlet</artifactId>
        <version>2.17.0</version> 
        <scope>provided</scope>                     
    </dependency>       
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-cxf</artifactId>
        <version>2.17.0</version>
        <scope>provided</scope>              
    </dependency>    
    <dependency>
        <groupId>org.apache.activemq</groupId>
        <artifactId>activemq-camel</artifactId>
        <version>5.11.0</version>
        <scope>provided</scope>            
    </dependency>
    </dependencies>
    <build>
    <finalName>${project.artifactId}-${project.version}</finalName>
    <resources>
        <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        </resource>
    </resources>
    <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <showDeprecation>true</showDeprecation>
        </configuration>
        </plugin>   
        <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>3.3.0</version>
        <extensions>true</extensions>
        <configuration>
            <instructions>
            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
            <Export-Package>aaa.bbb.ccc*</Export-Package>
            <Import-Package>*</Import-Package>
            </instructions>
        </configuration>
        </plugin>             
    </plugins>
    </build>
</project>

test url/return value

URL:
http://localhost:8182/service/getAll/

RETURNS:
[{"id": 100,"name": "JOE BLOW"}]    

Environment

IBM MQ server 9.0.3.0
IBM MQ client 8.0.0.7
jdk1.8.0_131
jboss-fuse-6.3.0.redhat-187

I've worked on a few Fuse/W-MQ integration exercises. Bundling the W-MQ client drivers into your application probably won't work on Fuse. You need to install the W-MQ client JARs into the Fuse run-time. IBM provides OSGi-compliant versions for that purpose.

My recollection is that there are nine in total, but not all are needed in all configurations. You can install them using osgi:install at the Karaf prompt, or just dump them in the deploy/ directory for testing purposes. Some configuration changes might need to be made in Fuse -- these depend on the specific version combination.

Your connection factory configuration looks broadly correct.

The "allcient" jars contain all of the other client bundles that Kevin was mentioning.

I'm a bit puzzled by what I am seeing, however. I downloaded the IBM MQ 9.0.3 client jars, and there is only the "com.ibm.mq.allclient.jar" in the zip.

For MQ 8, you would have the "com.ibm.mq.osgi.allclient.jar" and "com.ibm.mq.osgi.allclientprereqs.jar" bundles. The problem there is that the prereq bundle included the javax.jms interfaces. You would have to modify the prereq bundle to remove the JMS api jar in order to use it on Fuse. I do not know if this is still the case for MQ 9.

Specifically for Fuse 6.3:

My recollection is that Fuse 6.3 is tested against the client runtime for W-MQ 8, without needing modifications in Fuse. I can't remember whether that was with the individual 8-9 IBM bundles, or with the "allclient" bundle that Doug mentions. In any event, you need to avoid getting into a situation where you have a JMS 2.0 API JAR (that is, the bundle that includes the javax.jms.xxx classes) from both W-MQ and from Fuse -- they will clash. So if you install xxx_allclient.jar, you either need to not install xxx_allclientprereqs.jar, or uninstall the Fuse jms-api bundle from the Fuse runtime. If you go the route of using the heap of 8 or 9 bundles, you should install them all except one called something like xxx_jms.prereq_xxx.jar.

You can install using osgi:install or, for development, just copy them into the deploy/ directory on Fuse. In Fabric8 you'll need eventually to put the IBM JARs into some sort of repository and then create a profile that references them; but testing without Fabric8 in the first instance is probably worthwhile, to remove that additional source of complexity.

I haven't unpacked the W-MQ 9 allclient.jar, so I don't know what's inside it. If it contains javax.jms.xxx classes, either directly or in another internal JAR, then I guess you'll either need to unpack and repack the JAR without these classes, or uninstall the Fuse jms-api bundle.

In any event, Fuse 6.3 with W-MQ 8 client runtime is a good combination, and probably the easiest Fuse/W-MQ combination to get working. You don't necessarily have to use the W-MQ client runtime whose version that matches the W-MQ broker version, if a different client is easier to install on Fuse. However, you should check IBM's compatibility statement before going this way. My recollection is that the W-MQ 8 client runtime is certified by IBM to work with any 7.5.x broker, but I'm not sure whether compatibility works in the opposite direction.

FWIW my recommendation is that you shouldn't be afraid to use a bit of trial-and-error. I've been working with Fuse and W-MQ for a couple of years, and I still find I have to fiddle. Exceptions will help with troubleshooting.

(Posted solution on behalf of the question author, to move it to the answer space) .

Thanks to help/postings from generous forum contributors, below, I arrived at a working solution, below.

I included relatively full code/context, ie, to enable others to arrive at the solution more quickly than I did.

aaa.bbb.ccc.CamelRestRoutes.java

package aaa.bbb.ccc;

import org.apache.camel.builder.RouteBuilder;
import org.apache.camel.model.rest.RestBindingMode;

public class CamelRestRoutes extends RouteBuilder {

    public CamelRestRoutes() {
    }

    @Override
    public void configure() throws Exception {

    restConfiguration().component("restlet")
        .host("localhost")
        .port(8182)
        //.bindingMode(RestBindingMode.json_xml);
        .bindingMode(RestBindingMode.json);

    rest("/service")
        //.bindingMode(RestBindingMode.json_xml)
        .bindingMode(RestBindingMode.json)
        .get("/getAll")
        .produces("application/json")
        .to("direct:thingX");

    from("direct:thingX")
        .to("bean:camelRestService?method=getAll")
        .log("---------------------- (AAA) ----------------------> direct:thingX...:" + body().toString())
        .to("direct:thingY");

    from("direct:thingY")
        .log("---------------------- (BBB) ----------------------> direct:thingY...:" + body().toString())
        .to("direct:thingZ");

    from("direct:thingZ")
        .log("---------------------- (CCC) ----------------------> direct:thingZ...:" + body().toString())
        .to("wmq:queue:mylocalqueue?jmsMessageType=Text&exchangePattern=InOnly");        
    }
}

aaa.bbb.ccc.CamelRestService.java

package aaa.bbb.ccc;

import aaa.bbb.ccc.model.CamelRestPojo;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.Produces;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import javax.ws.rs.core.MediaType;

@Path("/service/")
public class CamelRestService {

    Map<Long, CamelRestPojo> itemMap = new HashMap<>();

    public CamelRestService() {
    init();
    }

    @GET
    //@Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    @Produces({MediaType.APPLICATION_JSON})
    @Path("/getAll/")
    public Collection<CamelRestPojo> getAll() {
    System.out.println("====================== (getAll) ---------------------->");
    return itemMap.values();
    }

    final void init() {
    System.out.println("---------------------- (init) ---------------------->");
    CamelRestPojo o = new CamelRestPojo();
    o.setName("JOE BLOW");
    o.setId(100);
    itemMap.put(o.getId(), o);
    }
}

aaa.bbb.ccc.model.CamelRestPojo

package aaa.bbb.ccc.model;

import java.io.Serializable;
public class CamelRestPojo implements Serializable {

    private long id;
    private String name;

    public long getId() {
    return id;
    }
    public void setId(long id) {
    this.id = id;
    }

    public String getName() {
    return name;
    }
    public void setName(String name) {
    this.name = name;
    }

    @Override
    public String toString() {
    return "CamelRestPojo{" + "id=" + id + ", name=" + name + '}';
    }
}

camel-route.xml

<?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"
       xmlns:cm="http://aries.apache.org/blueprint/xmlns/blueprint-cm/v1.0.0"
       xmlns:jaxrs="http://cxf.apache.org/blueprint/jaxrs"
       xmlns:camel="http://camel.apache.org/schema/blueprint"
       xsi:schemaLocation="
         http://www.osgi.org/xmlns/blueprint/v1.0.0 http://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
         http://cxf.apache.org/blueprint/jaxrs http://cxf.apache.org/schemas/blueprint/jaxrs.xsd
         http://cxf.apache.org/blueprint/core http://cxf.apache.org/schemas/blueprint/core.xsd
         ">
    <camel:camelContext id="aaa.bbb.ccc.routing.poc" xmlns="http://camel.apache.org/schema/blueprint">
    <packageScan>
        <package>aaa.bbb.ccc</package>
    </packageScan>
    </camel:camelContext>

    <bean id="camelRestService" class="aaa.bbb.ccc.CamelRestService"/> 

    <bean id="wmqcf" class="com.ibm.mq.jms.MQConnectionFactory">
    <property name="hostName" value="localhost"/>        
    <property name="port" value="1414"/>
    <property name="queueManager" value="QM1"/>     
    <property name="channel" value="DEV.ADMIN.SVRCONN"/>                     
    <property name="transportType" value="1"/>
    </bean>

    <bean id="wmqcfw"  class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
    <property name="targetConnectionFactory" ref="wmqcf" />
    <property name="username" value="admin" />
    <property name="password" value="passw0rd" />
    </bean>  

    <bean id="wmqcfg" class="org.apache.camel.component.jms.JmsConfiguration">
    <property name="connectionFactory" ref="wmqcfw"/>
    <property name="concurrentConsumers" value="10"/>
    </bean>

    <bean id="wmq" class="org.apache.camel.component.jms.JmsComponent">
    <property name="configuration" ref="wmqcfg"/>     
    </bean>    
</blueprint>

pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>aaa.bbb.ccc</groupId>
    <artifactId>camelRest</artifactId>
    <version>1</version>
    <packaging>bundle</packaging>
    <name>camelRest</name>
    <description>camelRest</description>

    <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <skipTests>true</skipTests>
    <mq.version>8.0.0.7</mq.version>
    </properties>

    <dependencies>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>1.7.25</version>
        <scope>provided</scope>               
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-api</artifactId>
        <version>1.7.25</version>
        <scope>provided</scope>               
    </dependency>
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-core</artifactId>
        <version>2.17.0</version>
        <scope>provided</scope>
    </dependency>           
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-restlet</artifactId>
        <version>2.17.0</version> 
        <scope>provided</scope>                     
    </dependency>       
    <dependency>
        <groupId>org.apache.camel</groupId>
        <artifactId>camel-cxf</artifactId>
        <version>2.17.0</version>
        <scope>provided</scope>              
    </dependency> 
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>allclient</artifactId>
        <version>${mq.version}</version>
        <scope>provided</scope>               
    </dependency>
    <dependency>
        <groupId>com.ibm.mq</groupId>
        <artifactId>jms</artifactId>
        <version>${mq.version}</version>
        <scope>provided</scope>
    </dependency>  

    </dependencies>

    <build>
    <finalName>${project.artifactId}-${project.version}</finalName>

    <resources>
        <resource>
        <directory>src/main/resources</directory>
        <filtering>true</filtering>
        </resource>
    </resources>

    <plugins>
        <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-compiler-plugin</artifactId>
        <version>3.1</version>
        <configuration>
            <source>1.8</source>
            <target>1.8</target>
            <showDeprecation>true</showDeprecation>
        </configuration>
        </plugin>   
        <plugin>
        <groupId>org.apache.felix</groupId>
        <artifactId>maven-bundle-plugin</artifactId>
        <version>3.3.0</version>
        <extensions>true</extensions>
        <configuration>
            <instructions>
            <Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
            <Export-Package>aaa.bbb.ccc*</Export-Package> 
            <Import-Package>*</Import-Package>                                                                      
            </instructions>
        </configuration>
        </plugin>             
    </plugins>
    </build>
</project>

here is the contents of the jboss fuse "deploy" folder

C:\tools\jboss-fuse-6.3.0.redhat-187\deploy>dir
 Volume in drive C is OSDisk
 Volume Serial Number is D89B-75DE

 Directory of C:\tools\jboss-fuse-6.3.0.redhat-187\deploy

08/17/2017  01:49 PM    <DIR>          .
08/17/2017  01:49 PM    <DIR>          ..
08/17/2017  01:49 PM             7,975 camelRest-1.jar
06/29/2017  01:00 AM           159,649 com.ibm.mq.osgi.allclientprereqs_8.0.0.7.jar
06/29/2017  01:00 AM         8,011,749 com.ibm.mq.osgi.allclient_8.0.0.7.jar
06/29/2017  01:00 AM         4,088,715 com.ibm.mq.osgi.java_8.0.0.7.jar
06/29/2017  01:00 AM           171,064 com.ibm.msg.client.osgi.commonservices.j2se_8.0.0.7.jar
06/29/2017  01:00 AM            48,715 com.ibm.msg.client.osgi.jms.prereq_8.0.0.7.jar.DISABLE
06/29/2017  01:00 AM           639,807 com.ibm.msg.client.osgi.jms_8.0.0.7.jar
06/29/2017  01:00 AM           216,218 com.ibm.msg.client.osgi.nls_8.0.0.7.jar
06/29/2017  01:00 AM           279,861 com.ibm.msg.client.osgi.wmq.nls_8.0.0.7.jar
06/29/2017  01:00 AM            92,406 com.ibm.msg.client.osgi.wmq.prereq_8.0.0.7.jar
06/29/2017  01:00 AM         7,963,226 com.ibm.msg.client.osgi.wmq_8.0.0.7.jar
09/15/2016  04:19 AM               873 README
          12 File(s)     21,680,258 bytes
           2 Dir(s)  143,871,660,032 bytes free

C:\tools\jboss-fuse-6.3.0.redhat-187\deploy>

Other notes

For what it is worth, I had add following features:

-camel-jackson
-camel-restlet

(I'm sure your "mileage will vary" as you tinker to make your IBM MQ app work, etc).

Also, fwiw, running:

features:list | grep "jms" 

yields:

    JBossFuse:karaf@root> features:list | grep "jms"
    [installed  ] [2.4.0.redhat-630187  ] jms                                           karaf-enterprise-2.4.0.redhat-630187   JMS service and commands
    [installed  ] [2.17.0.redhat-630187 ] camel-jms                                     camel-2.17.0.redhat-630187
    [uninstalled] [2.17.0.redhat-630187 ] camel-sjms                                    camel-2.17.0.redhat-630187
    [uninstalled] [3.1.5.redhat-630187  ] cxf-transports-jms                            cxf-3.1.5.redhat-630187
    [uninstalled] [2.1.0.redhat-630187  ] switchyard-jms                                switchyard-2.1.0.redhat-630187
    [uninstalled] [2.1.0.redhat-630187  ] switchyard-quickstart-bpel-jms-binding        switchyard-2.1.0.redhat-630187
    [uninstalled] [2.1.0.redhat-630187  ] switchyard-quickstart-camel-jms-binding       switchyard-2.1.0.redhat-630187
    [uninstalled] [2.1.0.redhat-630187  ] switchyard-demo-security-propagation-jms      switchyard-2.1.0.redhat-630187
    [uninstalled] [1.1                  ] jms-spec                                      activemq-core-5.11.0.redhat-630187     JMS spec 1.1 libraries
    [installed  ] [2.0                  ] jms-spec                                      activemq-core-5.11.0.redhat-630187     JMS spec 2.0 libraries
    [uninstalled] [1.1                  ] jms-spec-dep                                  activemq-core-5.11.0.redhat-630187     JMS spec 1.1 dependency
    [installed  ] [2.0                  ] jms-spec-dep                                  activemq-core-5.11.0.redhat-630187     JMS spec 2.0 dependency
    [uninstalled] [5.11.0.redhat-630187 ] activemq-jms-spec-dep                         activemq-core-5.11.0.redhat-630187     ActiveMQ broker libraries
    [installed  ] [3.2.16.RELEASE_1     ] spring-jms                                    spring-2.4.0.redhat-630187             Spring 3.2.x JMS support 
    

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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