12 Replies Latest reply on Jul 20, 2010 10:48 AM by Muthuvelan Swaminathan

    Problem  while connecting to Websphere MQ using servicemix-jms component

    dibs DG Newbie

      Hi,

       

      I am trying to connect to the Websphere MQ using the servicemix-jms component. But I am not able to build the service unit. I am using fuse ESB 3.4.

      The reason is it is not able to find the websphere mq jars (mqjms.jar).

       

      The error that I am getting is

       

      Caused by: java.lang.ClassNotFoundException: com.ibm.mq.jms.MQQueueConnectionFac

      tory

              at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

              at java.security.AccessController.doPrivileged(Native Method)

              at java.net.URLClassLoader.findClass(URLClassLoader.java:188)

              at java.lang.ClassLoader.loadClass(ClassLoader.java:306)

              at org.codehaus.classworlds.RealmClassLoader.loadClassDirect(RealmClassL

      oader.java:195)

              at org.codehaus.classworlds.DefaultClassRealm.loadClass(DefaultClassReal

      m.java:255)

       

      -


       

      I am also attaching the xbean.xml file. I have added the classpath in it to point to the required jars.

       

      It will be great if anyone can guide me on this issue.

       

      Cheers,

      D

        • 1. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
          Joe Luo Novice

          Could you please share the pom.xml file you used for building the smx-jms service unit? I believe you might need to specify dependencies pointing to the IBM MQ Jars.

          • 2. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
            Ulhas Bhole Novice

            Another option would be to add those jars to Servicemix classpath by adding them to lib/optional folder. This will add them on the container classpath and will be available to all the components.

             

            /Ulhas

            • 3. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
              dibs DG Newbie

              I added the jars in the mavan local repository and added the dependency in the pom... Now I am able to build it. Thanks for the response

              • 4. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
                Joe Luo Novice

                Also as Ulhas suggested, you could copy all the MQ related jars onto your Fuse esb 3.4.0.1 lib/optinal directory without putting any of those jars as dependency in your pom.xml file and build it. Then the container should be able to load the classes at runtime when you deploy the SA onto it.

                • 5. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
                  dibs DG Newbie

                  I believe this won't work at compile time. You will still get errors in generating the jbi.xml.

                  The only option that seem to work is to install the mq related jars in the local repository and then add it in the pom.

                  • 6. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
                    dibs DG Newbie

                    WHile trying to deploy the service assembly I am getting the following error. The xbean.xml is attached in the first message. Does anyone have a clue of it?

                    -


                    javax.jbi.management.DeploymentException: <component-task-result xmlns="http://java.sun.com/xml/ns/jbi/management-message">

                         <component-name>servicemix-jms</component-name>

                         <component-task-result-details>

                              <task-result-details>

                                   <task-id>deploy</task-id>

                                   <task-result>FAILED</task-result>

                                   <message-type>ERROR</message-type>

                                   <task-status-msg><msg-loc-info><loc-token/><loc-message>Could not deploy xbean service unit</loc-message></msg-loc-info></task-status-msg>

                                   <exception-info>

                                        <nesting-level>1</nesting-level>

                                        <msg-loc-info>

                                             <loc-token />

                                             <loc-message>Configuration problem: Unexpected failure during bean definition parsing

                    Offending resource: file

                    Bean 'mqconnectionFactory'; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized xbean namespace mapping: http://www.springframework.org/schema/util</loc-message>

                                             <stack-trace><![CDATA[org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unexpected failure during bean definition parsing

                    Offending resource: file

                    Bean 'mqconnectionFactory'; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized xbean namespace mapping: http://www.springframework.org/schema/util

                         at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)

                         at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:288)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:575)

                         at org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parseBeanDefinitionElement(XBeanBeanDefinitionParserDelegate.java:58)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:389)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:358)

                         at org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.processBeanDefinition(XBeanBeanDefinitionDocumentReader.java:174)

                         at org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseDefaultElement(XBeanBeanDefinitionDocumentReader.java:101)

                         at org.apache.xbean.spring.context.v2.XBeanBeanDefinitionDocumentReader.parseBeanDefinitions(XBeanBeanDefinitionDocumentReader.java:81)

                         at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)

                         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)

                         at org.apache.xbean.spring.context.v2.XBeanXmlBeanDefinitionReader.registerBeanDefinitions(XBeanXmlBeanDefinitionReader.java:79)

                         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)

                         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)

                         at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)

                         at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)

                         at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)

                         at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:149)

                         at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:212)

                         at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)

                         at org.apache.xbean.spring.context.FileSystemXmlApplicationContext.loadBeanDefinitions(FileSystemXmlApplicationContext.java:168)

                         at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:123)

                         at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:423)

                         at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:353)

                         at org.apache.servicemix.common.xbean.AbstractXBeanDeployer.deploy(AbstractXBeanDeployer.java:86)

                         at org.apache.servicemix.common.BaseServiceUnitManager.doDeploy(BaseServiceUnitManager.java:88)

                         at org.apache.servicemix.common.BaseServiceUnitManager.deploy(BaseServiceUnitManager.java:69)

                         at org.apache.servicemix.jbi.deployer.impl.ServiceUnitImpl.deploy(ServiceUnitImpl.java:89)

                         at org.apache.servicemix.jbi.deployer.impl.Deployer.deployServiceAssembly(Deployer.java:325)

                         at org.apache.servicemix.jbi.deployer.impl.Deployer.register(Deployer.java:188)

                         at org.apache.servicemix.jbi.deployer.impl.Deployer.checkPendingBundles(Deployer.java:456)

                         at org.apache.servicemix.jbi.deployer.impl.ComponentImpl$ComponentWrapper.init(ComponentImpl.java:263)

                         at org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl.doRegister(ComponentRegistryImpl.java:97)

                         at org.apache.servicemix.jbi.runtime.impl.ComponentRegistryImpl.doRegister(ComponentRegistryImpl.java:37)

                         at org.apache.servicemix.nmr.core.ServiceRegistryImpl.register(ServiceRegistryImpl.java:47)

                         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                         at java.lang.reflect.Method.invoke(Method.java:585)

                         at org.springframework.osgi.util.internal.ReflectionUtils.invokeMethod(ReflectionUtils.java:108)

                         at org.springframework.osgi.config.CustomListenerAdapterUtils.invokeCustomMethods(CustomListenerAdapterUtils.java:154)

                         at org.springframework.osgi.config.OsgiServiceLifecycleListenerAdapter.bind(OsgiServiceLifecycleListenerAdapter.java:186)

                         at org.springframework.osgi.service.importer.support.internal.util.OsgiServiceBindingUtils.callListenersBind(OsgiServiceBindingUtils.java:50)

                         at org.springframework.osgi.service.importer.support.internal.collection.OsgiServiceCollection$Listener.serviceChanged(OsgiServiceCollection.java:106)

                         at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:765)

                         at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:623)

                         at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:554)

                         at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3597)

                         at org.apache.felix.framework.Felix.access$000(Felix.java:36)

                         at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:626)

                         at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:559)

                         at org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:75)

                         at org.apache.felix.framework.Felix.registerService(Felix.java:2702)

                         at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:254)

                         at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:232)

                         at org.apache.servicemix.jbi.deployer.impl.Deployer.registerService(Deployer.java:463)

                         at org.apache.servicemix.jbi.deployer.impl.Deployer.maybeWrapComponent(Deployer.java:430)

                         at org.apache.servicemix.jbi.deployer.impl.Deployer$1.addingService(Deployer.java:133)

                         at org.osgi.util.tracker.ServiceTracker$Tracked.trackAdding(ServiceTracker.java:1030)

                         at org.osgi.util.tracker.ServiceTracker$Tracked.track(ServiceTracker.java:1008)

                         at org.osgi.util.tracker.ServiceTracker$Tracked.serviceChanged(ServiceTracker.java:933)

                         at org.apache.felix.framework.util.EventDispatcher.invokeServiceListenerCallback(EventDispatcher.java:765)

                         at org.apache.felix.framework.util.EventDispatcher.fireEventImmediately(EventDispatcher.java:623)

                         at org.apache.felix.framework.util.EventDispatcher.fireServiceEvent(EventDispatcher.java:554)

                         at org.apache.felix.framework.Felix.fireServiceEvent(Felix.java:3597)

                         at org.apache.felix.framework.Felix.access$000(Felix.java:36)

                         at org.apache.felix.framework.Felix$1.serviceChanged(Felix.java:626)

                         at org.apache.felix.framework.ServiceRegistry.fireServiceChanged(ServiceRegistry.java:559)

                         at org.apache.felix.framework.ServiceRegistry.registerService(ServiceRegistry.java:75)

                         at org.apache.felix.framework.Felix.registerService(Felix.java:2702)

                         at org.apache.felix.framework.BundleContextImpl.registerService(BundleContextImpl.java:254)

                         at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.registerService(OsgiServiceFactoryBean.java:401)

                         at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean.registerService(OsgiServiceFactoryBean.java:371)

                         at org.springframework.osgi.service.exporter.support.OsgiServiceFactoryBean$Executor.registerService(OsgiServiceFactoryBean.java:147)

                         at org.springframework.osgi.service.exporter.support.internal.controller.ExporterController.registerService(ExporterController.java:40)

                         at org.springframework.osgi.service.dependency.internal.DefaultMandatoryDependencyManager.startExporter(DefaultMandatoryDependencyManager.java:287)

                         at org.springframework.osgi.service.dependency.internal.DefaultMandatoryDependencyManager.checkIfExporterShouldStart(DefaultMandatoryDependencyManager.java:237)

                         at org.springframework.osgi.service.dependency.internal.DefaultMandatoryDependencyManager.discoverDependentImporterFor(DefaultMandatoryDependencyManager.java:230)

                         at org.springframework.osgi.service.dependency.internal.DefaultMandatoryDependencyManager.addServiceExporter(DefaultMandatoryDependencyManager.java:161)

                         at org.springframework.osgi.service.dependency.internal.MandatoryDependencyBeanPostProcessor.postProcessAfterInitialization(MandatoryDependencyBeanPostProcessor.java:46)

                         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:361)

                         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1343)

                         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)

                         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)

                         at java.security.AccessController.doPrivileged(Native Method)

                         at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)

                         at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)

                         at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:221)

                         at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)

                         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)

                         at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)

                         at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)

                         at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:729)

                         at org.springframework.osgi.context.support.AbstractDelegatedExecutionApplicationContext.completeRefresh(AbstractDelegatedExecutionApplicationContext.java:276)

                         at org.springframework.osgi.extender.internal.dependencies.startup.DependencyWaiterApplicationContextExecutor$CompleteRefreshTask.run(DependencyWaiterApplicationContextExecutor.java:145)

                         at java.lang.Thread.run(Thread.java:595)

                    Caused by: org.springframework.beans.factory.BeanDefinitionStoreException: Unrecognized xbean namespace mapping: http://www.springframework.org/schema/util

                         at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parseBeanFromExtensionElement(XBeanNamespaceHandler.java:277)

                         at org.apache.xbean.spring.context.v2c.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:155)

                         at org.apache.xbean.spring.context.v2.XBeanNamespaceHandler.parse(XBeanNamespaceHandler.java:49)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseCustomElement(BeanDefinitionParserDelegate.java:1255)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseNestedCustomElement(BeanDefinitionParserDelegate.java:1304)

                         at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                         at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                         at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                         at java.lang.reflect.Method.invoke(Method.java:585)

                         at org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.internalParseNestedCustomElement(XBeanBeanDefinitionParserDelegate.java:90)

                         at org.apache.xbean.spring.context.v2c.XBeanBeanDefinitionParserDelegate.parsePropertySubElement(XBeanBeanDefinitionParserDelegate.java:47)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parsePropertySubElement(BeanDefinitionParserDelegate.java:902)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parsePropertyValue(BeanDefinitionParserDelegate.java:892)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parsePropertyElement(BeanDefinitionParserDelegate.java:785)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parsePropertyElements(BeanDefinitionParserDelegate.java:661)

                         at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:560)

                         ... 93 more

                    ]]></stack-trace>

                    • 7. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
                      Joe Luo Novice

                      Not really sure what was wrong. I have attached a simple test case that uses smx-jms component to connect to IBM websphere MQ to consume messages from the MQ queue and send it to a file. It works for me.

                       

                      So, the steps as following:

                      1. build the project. (You might want to change MyFileService directory from smx-file-sender-su project as well as MQService configuration from jms-MQ-consumer-su to suit your environment;

                      2. copy com.ibm.mq.jar, com.ibm.mqjms.jar, connector.jar, dhbcore.jar and jndi.jar that supplied from Websphere MQ installation to 3.4.0.1-fuse "lib\optional" directory;

                      3. deploy SA to the Fuse esb 3.4.0.1-fuse hotdeploy directory;

                      4. add a XML message to the Websphere MQ queue (you could use "put test message" utility from MQ Explorer on the queue.

                       

                      Hope it helps,

                      • 8. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
                        dibs DG Newbie

                        Thanks a lot Joe for your help.

                         

                        The error that I was getting was mainly because it wasn't getting the spring-util-2.0.xsd. I could resolve this.

                         

                        But there's still a problem because of the version of jms.jar. I am connecting to Websphere MQ 5.3 through SMX 4.0. MQ 5.3 uses version 1.0.2 of jms.jar while smx 4.0 uses jms 1.1.

                         

                        Cheers,

                        D

                        • 9. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
                          Joe Luo Novice

                          I overlooked package name showed in stacktrace, i.e. "org.apache.felix...". I thought you were using Fuse ESB 3.4.0.1-fuse version as mentioned in your previous post.

                           

                          Connecting to Websphere MQ using smx-jms component from Smx 4 container can be a bit more tricky as you will need install Websphere MQ jars as OSGI bundles. I am not sure if anyone have tried it yet.

                           

                          I believe Websphere MQ 6.0 is using JMS 1.1, have you tried with this version yet?

                           

                          Edited by: joeluo on Apr 30, 2009 9:26 AM

                          • 10. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
                            dibs DG Newbie

                            Joe,

                             

                            I am not using MQ 6 as we will have to use MQ 5.3 as it forms the messaging infrastructure of my client.

                             

                            I was doing a bit of a evalutaion for Fuse and see how it connects to MQ.

                             

                            Thanks,

                            D

                            • 11. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
                              Muthuvelan Swaminathan Newbie

                              Hi ddg,

                               

                              How did you resolve the spring-util.xsd (unrecognized xbean name space mapping error)?

                               

                              Thanks

                              ms.

                              • 12. Re: Problem  while connecting to Websphere MQ using servicemix-jms component
                                Muthuvelan Swaminathan Newbie

                                Problem went away when  I copied the springframework beans jar to the servicemix_home/lib. Is that the right way to resolve this issue.

                                 

                                Thanks