3 Replies Latest reply on Oct 20, 2010 9:41 AM by renaud.denis

    JMS: JBossMQ Integration with FUSE ESB 4.2

    renaud.denis

      Hi,

       

      I have some hard time trying to embed the JBoss client libraries so I can just lookup a JNDI JMS connectionFactory.

       

      My use case is simple: consuming and producing JMS messages from and to external JBossMQ JMS queues within a Camel context.

       

      The use case is working properly when I'm running it out of the container (running org.apache.camel.spring.Main.main()).

       

      In the container, I'm facing real troubles. The JBoss client doesn't exist as a bundle (even on springsource). They seem to not even provide a valid Maven POM for it.

       

      Embedding the jbossall-client in a Karaf feature using the wrap scheme won't work:

       

       

       

      I get a lot of missing constraints, cause I didn't embed in my feature the dozens of JARs provided with the JBoss client I guess.

       

      As someone ever faced this issue? Can you give me some leads to fix this?

        • 1. Re: JMS: JBossMQ Integration with FUSE ESB 4.2
          renaud.denis

          Coming back on that one. I'll try to be more detailed. I guess it's a matter of OSGi understanding, I hope somebody can give me a lead to solve the issue.

           

          So I have 2 app components, one deployed under JBoss 4.2, the other under Tomcat 6 (no embedded broker).  5 JMS queues are used: 2 on the JBoss component, 3 on the ESB (ActiveMQ).

           

          My goal: ESB being able to consume and post on queues, JBossMQ and ActiveMQ, from and to both components.

           

          Here is my set of OSGi bundles:

           

          • 1 bundle A for wrapping the Jboss Client library

          • 2 bundles B, C (my Camel routes) depending on A

          • 1 feature F, containing my 3 bundles and their dependencies

           

          When I install my feature within FUSE ESB, here is the stack I get (when Spring attempts to inject the JMS ConnectionFactory, so AFTER the JNDI lookup was successful):

           


          karaf@root>

          Exception in thread "SpringOsgiExtenderThread-2" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jms' defined in OSGi resource[classpath:META-INF/messaging-jboss-strategy.xml|bnd.id=135|bnd.sym=xyz-fuse-glue-client-notification]: Cannot resolve reference to bean 'jmsConfiguration' while setting bean property 'configuration'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsConfiguration' defined in OSGi resource[classpath:META-INF/messaging-jboss-strategy.xml|bnd.id=135|bnd.sym=xyz-fuse-glue-client-notification]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'javax.naming.Reference' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type to required type for property 'connectionFactory': no matching editors or conversion strategy found

                  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:328)

                  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:106)

                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1317)

                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)

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

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

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

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

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

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

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

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

                  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:136)

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

          Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jmsConfiguration' defined in OSGi resource[classpath:META-INF/messaging-jboss-strategy.xml|bnd.id=135|bnd.sym=xyz-fuse-glue-client-notification]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'javax.naming.Reference' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type to required type for property 'connectionFactory': no matching editors or conversion strategy found

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

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

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

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

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

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

                  at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:322)

                  ... 17 more

          Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'javax.naming.Reference' to required type 'javax.jms.ConnectionFactory' for property 'connectionFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type to required type for property 'connectionFactory': no matching editors or conversion strategy found

                  at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:462)

                  at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:499)

                  at org.springframework.beans.BeanWrapperImpl.convertForProperty(BeanWrapperImpl.java:493)

                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.convertForProperty(AbstractAutowireCapableBeanFactory.java:1363)

                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1322)

                  at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1076)

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

                  ... 23 more

          Caused by: java.lang.IllegalStateException: Cannot convert value of type to required type for property 'connectionFactory': no matching editors or conversion strategy found

                  at org.springframework.beans.TypeConverterDelegate.convertIfNecessary(TypeConverterDelegate.java:231)

                  at org.springframework.beans.BeanWrapperImpl.convertIfNecessary(BeanWrapperImpl.java:447)

                  ... 29 more

          </code>

           

          -


           

          Here is my feature.xml:

           

           

           

          -


           

          Here is the MANIFEST.MF of my JBoss Bundle (Bundle A):

           


          Manifest-Version: 1.0
          Export-Package: org.jnp.interfaces;uses:="javax.naming,javax.net,javax
          .naming.spi",org.jboss.mq;uses:="javax.jms,javax.naming"
          Ignore-Package: org.hibernate.loader.collection,org.omg.CosNaming.Nami
          ngContextPackage,org.hibernate.dialect.function,org.apache.tomcat.uti
          l.net,org.apache.log4j,javassist,java.net,org.omg.PortableServer,org.
          apache.log4j.spi,org.apache.tomcat.util.http,org.xml.sax,org.jboss.ej
          b3.cache,org.apache.lucene.store,junit.framework,org.apache.webdav.li
          b,java.security.acl,org.hibernate.impl,java.util.zip,org.omg.IOP,java
          .awt.event,javax.persistence,java.util.concurrent,org.apache.xml.util
          s,org.jboss.annotation.ejb,javax.swing.border,org.hibernate.cache.ent
          ry,net.sf.cglib.proxy,javassist.bytecode.annotation,java.rmi.dgc,org.
          jboss.security.auth.spi,java.util.concurrent.locks,org.omg.CORBA.port
          able,org.jboss.aop.classpool,javax.security.auth,org.jnp.interfaces,j
          avax.crypto,org.w3c.dom,org.bouncycastle.asn1,javax.xml.rpc,java.lang
          .reflect,org.jboss.aop.pointcut,org.hibernate.metadata,org.hibernate.
          engine.query,javax.xml.transform.stream,org.hibernate.property,java.s
          ecurity.spec,org.apache.lucene.search,java.sql,java.beans,org.jboss.e
          jb3.entity.hibernate,javax.annotation,org.apache.commons.logging,org.
          apache.avalon.framework.configuration,org.apache.commons.collections,
          org.jboss.aop.annotation,java.lang.annotation,javax.security.auth.log
          in,org.omg.CORBA,org.jboss.beans.metadata.spi,org.hibernate.sql,org.a
          pache.xpath.functions,javax.xml.transform.dom,org.w3c.dom.traversal,o
          rg.hibernate.loader.custom,org.omg.IOP.CodecPackage,org.hibernate.eng
          ine.query.sql,java.math,org.apache.xpath,javax.security.cert,org.jbos
          s.metadata,org.jboss.ejb3.tx,java.lang.ref,org.apache.lucene.document
          ,org.hibernate.lob,javax.rmi.CORBA,sun.misc,java.awt,org.omg.CosNamin
          g,org.hibernate.persister.entity,org.dom4j,sun.reflect,javax.crypto.s
          pec,org.apache.bcel.classfile,java.security.cert,org.jboss.mq,javax.s
          ecurity.auth.spi,java.rmi,org.jboss.kernel,org.dom4j.io,org.hibernate
          .usertype,org.jboss.kernel.spi.dependency,java.util.jar,org.apache.xm
          l.dtm,javassist.util.proxy,org.jboss.ejb3.security,gnu.trove,org.apac
          he.xpath.objects,org.jgroups.stack,javax.xml.namespace,org.apache.luc
          ene.index,org.apache.commons.httpclient,javax.servlet,org.jboss.beans
          .metadata.plugins,org.hibernate.classic,org.jboss.aop.introduction,ja
          vax.swing,org.jboss.dom4j,java.io,org.jboss.annotation,org.jboss.dom4
          j.io,java.lang,javax.net.ssl,antlr,javax.xml.parsers,org.jboss.aop.po
          intcut.ast,javassist.scopedpool,org.apache.coyote,org.hibernate.loade
          r.entity,org.hibernate.dialect,javax.xml.rpc.handler,org.jboss.wsf.sp
          i.deployment,org.jboss.wsf.spi.serviceref,org.jboss.ejb3.entity,org.j
          boss.metadata.serviceref,java.util.logging,org.xml.sax.helpers,org.ap
          ache.xpath.compiler,org.apache.log4j.helpers,javassist.bytecode,java.
          nio.channels,java.util,org.jboss.xb.binding,org.jacorb.config,java.rm
          i.server,java.security.interfaces,org.hibernate.event,java.rmi.regist
          ry,org.omg.PortableInterceptor,org.apache.bcel.generic,org.jboss.aop.
          annotation.ast,org.apache.tomcat.util.buf,org.jboss.annotation.ejb.ca
          che,java.util.regex,org.apache.xerces.xni,org.jboss.ejb3.webservice,o
          rg.jboss.kernel.spi.registry,org.omg.PortableInterceptor.ORBInitInfoP
          ackage,javax.security.auth.callback,org.jboss.ejb3.embedded.resource,
          java.text,java.nio,org.apache.avalon.framework.logger,org.jboss.wsf.c
          ommon,org.jboss.metamodel.descriptor,org.apache.tomcat.jni,javax.acti
          vation,org.apache.xerces.xs,java.security,sun.security.util,org.apach
          e.lucene.analysis.standard,org.jboss.dependency.spi,org.jboss.aop.uti
          l.reference,javax.xml.transform,org.omg.CORBA_2_3,org.omg.CORBA_2_3.p
          ortable,javax.rmi,org.hibernate.stat,javax.xml.ws,org.omg.CosTransact
          ions,javax.servlet.http,org.apache.lucene.analysis
          Built-By: xyz
          Tool: Bnd-0.0.357
          Bundle-Name: JBoss Client (All) Bundle
          Created-By: Apache Maven Bundle Plugin
          Build-Jdk: 1.6.0_17
          Bundle-Version: 4.2.3.GA
          Bnd-LastModified: 1286370606765
          Bundle-ManifestVersion: 2
          Import-Package: javax.jms,javax.naming,javax.naming.spi,javax.net
          Bundle-SymbolicName: com.xyz.org.jboss.client.jbossallClient
          Embed-Dependency: jbossall-client;inline=true,

           

          -


           

          MANIFEST.MF For my bundle Camel Route (Bundle B)

           


          Manifest-Version: 1.0
          Archiver-Version: Plexus Archiver
          Created-By: 1.6.0_17 (Sun Microsystems Inc.)
          Built-By: xyz
          Build-Jdk: 1.6.0_17
          Require-Bundle: org.springframework.osgi.core
          Export-Package: com.xyz.docgen.glue.notification;uses:="org.apache.cam
          el.spring";version="1.0.0.fbr-SNAPSHOT",properties;version="1.0.0.fbr
          -SNAPSHOT"
          Bundle-Version: 1.0.0.fbr-SNAPSHOT
          Tool: Bnd-0.0.357
          Bundle-Name: Standard FUSE ESB Glue :: Client Notification Route
          Bnd-LastModified: 1285768968441
          Bundle-ManifestVersion: 2
          Bundle-SymbolicName: xyz-fuse-glue-client-notification
          Import-Package: com.xyz.docgen.glue.notification;version="1.0",org.apa
          che.camel.component.jms;version="2.4",org.apache.camel.spring;version
          ="2.4",org.jnp.interfaces,org.springframework.jms;version="3.0",org.s
          pringframework.jms.support;version="3.0",org.springframework.jms.supp
          ort.destination;version="3.0",org.springframework.jndi;version="3.0",
          properties;version="1.0"

          • 2. Re: JMS: JBossMQ Integration with FUSE ESB 4.2
            renaud.denis

            And this is a segment of my spring application context, of course:

             

             

             

            The connection factory is then used together with a new 'jboss' JMS component (or will be)

            • 3. Re: JMS: JBossMQ Integration with FUSE ESB 4.2
              renaud.denis

              Conversations with myself...

               

              fyi,

               

              The problem was a missing package in the import-packages. You can see it by attaching a remote debugger on servicemix when running the exception.

               

              Here is the interesting part of my list of imported packages:

               


              org.jnp.interfaces,
              org.jboss.mq,
              org.jboss.mq.referenceable,
              org.apache.activemq,
              javax.jms,
              javax.naming,
              javax.naming.spi,
              javax.net,



              The

              org.jboss.mq.referenceable

              package was the m*fr

               

              Hope this will help somebody.