ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » WMQ JMS Provider OSGi causes an error in ServiceMix 6.0.0

Post new topic  Reply to topic
 WMQ JMS Provider OSGi causes an error in ServiceMix 6.0.0 « View previous topic :: View next topic » 
Author Message
catshout
PostPosted: Wed Jul 15, 2015 7:53 am    Post subject: WMQ JMS Provider OSGi causes an error in ServiceMix 6.0.0 Reply with quote

Acolyte

Joined: 15 May 2012
Posts: 57

Dear community,

I've installed the brand new ServiceMix 6.0.0. As I did before successfully I wanted to establish a connection to a locally running WMQ 7.5.0.1 server. The steps are

1. copy all files from <i>/opt/mqm/java/lib/OSGi</i> folder (the OSGi wrapped WMQ classes) to the <i>smhome/deploy</i> directory.
2. copy the wmqbridge.xml to the <i>smhome/deploy</i> directory, this looks like

Code:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:osgix="http://www.springframework.org/schema/osgi-compendium"
   xmlns:context="http://www.springframework.org/schema/context"
   xmlns:util="http://www.springframework.org/schema/util"
   xmlns:camel="http://camel.apache.org/schema/spring"
   xmlns:p="http://www.springframework.org/schema/p"
   xsi:schemaLocation="http://camel.apache.org/schema/spring
                  http://camel.apache.org/schema/spring/camel-spring.xsd
                  http://www.springframework.org/schema/beans
                  http://www.springframework.org/schema/beans/spring-beans.xsd
                  http://www.springframework.org/schema/util
                  http://www.springframework.org/schema/util/spring-util-2.5.xsd
                  http://www.springframework.org/schema/context
                  http://www.springframework.org/schema/context/spring-context.xsd
                  http://www.springframework.org/schema/osgi
                  http://www.springframework.org/schema/osgi/spring-osgi.xsd
                  http://www.springframework.org/schema/osgi-compendium
                  http://www.springframework.org/schema/osgi-compendium/spring-osgi-compendium.xsd">

   <osgix:cm-properties id="cmProps" persistent-id="wmqbridge">
      <prop key="host">localhost</prop>
      <prop key="port">1414</prop>
      <prop key="queuemanager">QM</prop>
      <prop key="channel">SYSTEM.ADMIN.SVRCONN</prop>
   </osgix:cm-properties>

   <context:property-placeholder properties-ref="cmProps" />

   <bean id="redeliveryPolicyConfig" class="org.apache.camel.processor.RedeliveryPolicy">
      <property name="maximumRedeliveries" value="6" />
      <property name="redeliveryDelay" value="10000" />
   </bean>

   <bean id="deadLetterErrorHandler" class="org.apache.camel.builder.DeadLetterChannelBuilder">
      <property name="deadLetterUri" value="activemq:queue:AMQ.DLQ" />
      <property name="redeliveryPolicy" ref="redeliveryPolicyConfig" />
   </bean>

   <camel:camelContext id="wmqbridge">

      <camel:route id="AMQ2WMQ" errorHandlerRef="deadLetterErrorHandler">
         <camel:from uri="activemq:WMQ.OUT" />
         <camel:transacted />
         <camel:to uri="wmq:AMQ.IN" />
         <camel:log message="Route from ActiveMQ to WMQ executed" />
      </camel:route>

      <camel:route id="WMQ2AMQ" errorHandlerRef="deadLetterErrorHandler">
         <camel:from uri="wmq:AMQ.OUT" />
         <camel:transacted />
         <camel:to uri="activemq:WMQ.IN" />
         <camel:log message="Route from WMQ to ActiveMQ executed" />
      </camel:route>

   </camel:camelContext>

   <bean
      class="org.springframework.beans.factory.config.MethodInvokingFactoryBean"
      p:staticMethod="com.ibm.mq.MQEnvironment.addConnectionPoolToken" />

   <bean id="wmq" class="org.apache.camel.component.jms.JmsComponent">
      <property name="connectionFactory">
         <bean class="com.ibm.mq.jms.MQQueueConnectionFactory">
            <osgix:managed-properties persistent-id="wmqbridge" update-strategy="container-managed" />
            <property name="transportType">
               <util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP" />
            </property>
            <property name="hostName" value="${hostname}" />
            <property name="port" value="${port}" />
            <property name="queueManager" value="${queuemanager}" />
            <property name="channel" value="${channel}" />
            <property name="useConnectionPooling" value="true" />
         </bean>
      </property>
   </bean>

</beans>


With this deployed I'm getting an error

Code:

Exception in thread "SpringOsgiExtenderThread-4" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.beans.factory.config.MethodInvokingFactoryBean#0' defined in URL [bundle://256.0:0/META-INF/spring/wmqbridge.xml]: Invocation of init method failed; nested exception is java.lang.ClassNotFoundException: com.ibm.mq.MQEnvironment not found from bundle [wmqbridge.xml]
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1514)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:293)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:290)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:191)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:618)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:934)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.access$1600(AbstractDelegatedExecutionApplicationContext.java:69)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext$4.run(AbstractDelegatedExecutionApplicationContext.java:355)
        at org.springframework.osgi.util.internal.PrivilegedUtils.executeWithCustomTCCL(PrivilegedUtils.java:85)
        at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:320)
        at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:132)
        at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: com.ibm.mq.MQEnvironment not found from bundle [wmqbridge.xml]
        at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:103)
        at org.springframework.osgi.util.BundleDelegatingClassLoader.loadClass(BundleDelegatingClassLoader.java:156)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.springframework.util.ClassUtils.forName(ClassUtils.java:265)
        at org.springframework.beans.factory.config.MethodInvokingFactoryBean.resolveClassName(MethodInvokingFactoryBean.java:123)
        at org.springframework.util.MethodInvoker.prepare(MethodInvoker.java:153)
        at org.springframework.beans.factory.config.MethodInvokingFactoryBean.afterPropertiesSet(MethodInvokingFactoryBean.java:149)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1573)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1511)
        ... 14 more
Caused by: java.lang.ClassNotFoundException: com.ibm.mq.MQEnvironment not found by com.ibm.msg.client.osgi.wmq [254]
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1532)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1374)
        at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1553)
        at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1484)
        at org.apache.felix.framework.BundleWiringImpl.access$400(BundleWiringImpl.java:75)
        at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1955)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at org.apache.felix.framework.Felix.loadBundleClass(Felix.java:1844)
        at org.apache.felix.framework.BundleImpl.loadClass(BundleImpl.java:937)
        at org.springframework.osgi.util.BundleDelegatingClassLoader.findClass(BundleDelegatingClassLoader.java:99)
        ... 22 more



The bundle itself seems to be able to resolve/import the package <i>com.ibm.mq.jms</i>, see below.

Code:

256    
 
wmqbridge.xmlwmqbridge.xml
Symbolic Name   wmqbridge.xml
Version   0.0.0
Bundle Location   spring:file:/home/wbimb/apache-servicemix-6.0.0/deploy/wmqbridge.xml
Last Modification   Wed Jul 15 17:27:10 CEST 2015
Start Level   80
Exported Packages   ---
Imported Packages   com.ibm.mq,version=0.0.0 from com.ibm.msg.client.osgi.wmq (254)
com.ibm.mq.jms,version=0.0.0 from com.ibm.msg.client.osgi.wmq (254)
javax.servlet,version=2.6.0 from org.apache.geronimo.specs.geronimo-servlet_3.0_spec (45)
javax.servlet,version=3.0.0 from org.apache.geronimo.specs.geronimo-servlet_3.0_spec (45)
org.apache.activemq,version=5.11.1 from org.apache.activemq.activemq-osgi (156)
org.apache.camel,version=2.15.2 from org.apache.camel.camel-core (137)
org.apache.camel.builder,version=2.15.2 from org.apache.camel.camel-core (137)
org.apache.camel.component.jms,version=2.15.2 from org.apache.camel.camel-jms (186)
org.apache.camel.model,version=2.15.2 from org.apache.camel.camel-core (137)
org.apache.camel.osgi,version=2.15.2 from org.apache.camel.camel-spring (141)
org.apache.camel.processor,version=2.15.2 from org.apache.camel.camel-core (137)
org.apache.camel.spi,version=2.15.2 from org.apache.camel.camel-core (137)
org.apache.camel.spring,version=2.15.2 from org.apache.camel.camel-spring (141)
org.apache.xerces.impl.dv.dtd,version=2.11.0 from org.apache.felix.framework (0)
org.apache.xerces.impl.dv.xs,version=2.11.0 from org.apache.felix.framework (0)
org.osgi.service.cm,version=1.5.0 from org.apache.felix.configadmin (6)
org.osgi.service.packageadmin,version=1.2.0 from org.apache.felix.framework (0)
org.springframework.beans.factory.config,version=3.2.11.RELEASE from org.apache.servicemix.bundles.spring-beans (122)
org.springframework.beans.factory.xml,version=3.2.11.RELEASE from org.apache.servicemix.bundles.spring-beans (122)
org.springframework.beans.support,version=3.2.11.RELEASE from org.apache.servicemix.bundles.spring-beans (122)
org.springframework.context.support,version=3.2.11.RELEASE from org.apache.servicemix.bundles.spring-context (124)
org.springframework.core.io.support,version=3.2.11.RELEASE from org.apache.servicemix.bundles.spring-core (120)
org.springframework.osgi.compendium.cm,version=1.2.1 from org.springframework.osgi.core (128)
org.springframework.util,version=3.2.11.RELEASE from org.apache.servicemix.bundles.spring-core (120)
org.xml.sax,version=0.0.0 from org.apache.felix.framework (0)
Manifest Headers   Bundle-ManifestVersion: 2
Bundle-SymbolicName: wmqbridge.xml
Bundle-Version: 0.0.0
DynamicImport-Package: *
Import-Package: com.ibm.mq.jms, org.apache.camel.builder, org.apache.camel.component.jms, org.apache.camel.processor, org.springframework.beans.factory.config
Manifest-Version: 2
Spring-Context: *; publish-context:=false; create-asynchronously:=true
Used Services   
Service #1 of type(s) [org.osgi.service.packageadmin.PackageAdmin]
Service #492 of type(s) [org.xml.sax.EntityResolver]
Service #491 of type(s) [org.springframework.beans.factory.xml.NamespaceHandlerResolver]
Service #15 of type(s) [org.osgi.service.cm.ConfigurationAdmin]


As I mentioned at the beginning, this approach did work like a charm in ServiceMix 5.4.0, just tested it for reference.

Does anybody have an idea what might have been changed in ServiceMix 6.0.0 so far? Any hints are highly appreciated.
Back to top
View user's profile Send private message
catshout
PostPosted: Thu Jul 16, 2015 1:15 am    Post subject: Reply with quote

Acolyte

Joined: 15 May 2012
Posts: 57

I've posted already the question in the Apache ServiceMix forum, please check this out here ..

http://servicemix.396122.n5.nabble.com/WMQ-JMS-Provider-OSGi-classes-cause-an-error-since-SM-6-0-0-tp5722815.html

In a nutshell, there's a package split. The package com.ibm.mq is exported by 2 bundles:

com.ibm.mq.osgi.java
com.ibm.mq

If the OSGi container loads the wrong one first the class com.ibm.mq.MQEnvironment cannot be found.

I'll proceed to check this out with MQ Client libs 8.0.0.3.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » WMQ JMS Provider OSGi causes an error in ServiceMix 6.0.0
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.