1 2 Previous Next 16 Replies Latest reply: Jun 19, 2012 3:25 PM by goldengate001 RSS

JBOSS AS 7(HornetQ) to ActiveMQ messaging

goldengate001 Newbie

Has anyone had  success in setting up connectivity from JBOSS AS 7 to ActiveMQ? All I have seen on the forum or web so far either replaces the HornetQ with ActiveMQ or accepts the ActiveMQ as incoming.

My requirement is to post a message to local HornetQ on JBOSS AS 7, which triggers an MDB, that transports the message to a Remote ActiveMQ.

 

I have little or no success so far setting up the MDB that consumes the message from HornetQ(on JBOSS AS 7) and sending it to the Remote ActiveMQ.

 

Please point me to any resources to proceed in this regard. Thanks!

  • 1. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    Justin Bertram Master

    Creating an MDB which will run in JBoss AS7 and consume from a local JMS destination managed by HornetQ is pretty straight forward.  You simply need to define your destination (documentation here), e.g.:

     

    <jms-destinations>
       <jms-queue name="testQueue">
          <entry name="jms/queue/test"/>
          <entry name="java:jboss/exported/jms/queue/test"/>
       </jms-queue>
    </jms-destinations>
    

     

    Then write your MDB, e.g.:

     

    import javax.ejb.ActivationConfigProperty;
    import javax.ejb.MessageDriven;
    import javax.jms.Message;
    import javax.jms.MessageListener;
    
    @MessageDriven(activationConfig = {
                        @ActivationConfigProperty(propertyName = "destinationType", propertyValue = "javax.jms.Queue"),
                        @ActivationConfigProperty(propertyName = "destination", propertyValue = "jms/queue/test") })
    public class HelloWorldMDB implements MessageListener {
       public void onMessage(Message message) {
          // Do something with the message you received
       }
    }
    

     

    To then send a message to an ActiveMQ server you have a couple of options...

     

    You can use the non-JCA approach, e.g.:

     

    Properties props = new Properties();
    props.put("java.naming.factory.initial", "org.apache.activemq.jndi.ActiveMQInitialContextFactory");
    props.put("java.naming.provider.url", "tcp://localhost:61616");
    props.put("queue.source", "source");
    
    InitialContext initialcontext = new InitialContext(props);
    ConnectionFactory connectionFactory = (ConnectionFactory) initialcontext.lookup("ConnectionFactory");
    Connection connection = connectionFactory.createConnection();
    Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
    MessageProducer producer = session.createProducer((Destination) initialcontext.lookup("source"));
    TextMessage textmessage = session.createTextMessage("text");
    producer.send(textmessage);
    connection.close();
    

     

    Or you can deploy the ActiveMQ JCA Resource Adapter and configure a <resource-adapter> in your standalone*.xml.  You can download IronJacamar 1.1.0.Beta1 and use the resource adapter information tool to generate an example config to use (a sample report based on the 5.6-SNAPSHOT version is attached to this comment).  You'll need a connection factory and likely a destination admin object.  Once you get the configuration correct you can inject those artifacts into your MDB.  The advantages of this approach are:

    • The code to use these will be much simpler since they won't require any InitialContext boiler-plate.
    • Performance will be better because the connections will be pooled (provided by the IronJacamar JCA implementation).
    • Management will be easier because it will be in standalone*.xml rather than the code.
    • If the JCA connection factory is configured to use XA then any connection created from the factory will be automatically enlisted into the ongoing JTA transaction (e.g. the one in which the MDB is running). That way the consumption of the message by the MDB and the sending of the message to the remote destination would be atomic.

     

    Message was edited by: Justin Bertram

  • 2. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    goldengate001 Newbie

    Justin,

     

    Thank you very much for the reply. I am currently migrating the non-JCA piece. Here is the exception, that I am seeing.

     

    Caused by: java.lang.NoClassDefFoundError: javax/naming/spi/InitialContextFactory

     

    followed by

     

    Caused by: java.lang.ClassNotFoundException: javax.naming.spi.InitialContextFactory from [Module "activemq:main" from local module loader @1171b26 (roots: /Applications/jboss-as-7.1.1.Final/modules)]

  • 3. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    Justin Bertram Master

    Can you include the full stack trace you are seeing? 

     

    Also, what kind of deployment are you using?  Does it specify any module dependencies?

  • 4. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    goldengate001 Newbie

    I am deploying the web services, ejb(session and mdb) as a jar file. The jar file manifest has the following dependencies: drools,quartz,joda-time,activemq.

     

    Drools dependency includes all the jars from Drools 5.4.0

    Quartz dependency includes quartz-all-2.0.1.jar

    joda-time dependency includes joda-time-2.0.jar

    activemq dependency includes activemq-all-5.4.2.jar

     

    Below is the stack trace.

     

    ------------------------------------

     

    09:20:10,662 WARN  [org.jboss.modules] (Thread-2 (HornetQ-client-global-threads-29021774)) Failed to define class org.apache.activemq.jndi.ActiveMQInitialContextFactory in Module "activemq:main" from local module loader @1171b26 (roots: /Applications/jboss-as-7.1.1.Final/modules): java.lang.LinkageError: Failed to link org/apache/activemq/jndi/ActiveMQInitialContextFactory (Module "activemq:main" from local module loader @1171b26 (roots: /Applications/jboss-as-7.1.1.Final/modules))

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:396)

        at org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:243)

        at org.jboss.modules.ModuleClassLoader$1.loadClassLocal(ModuleClassLoader.java:73)

        at org.jboss.modules.Module.loadModuleClass(Module.java:517)

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:182)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

        at java.lang.Class.forName0(Native Method) [classes.jar:1.6.0_33]

        at java.lang.Class.forName(Class.java:247) [classes.jar:1.6.0_33]

        at org.jboss.as.naming.InitialContextFactoryBuilder.createInitialContextFactory(InitialContextFactoryBuilder.java:61)

        at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:664) [classes.jar:1.6.0_33]

        at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288) [classes.jar:1.6.0_33]

        at javax.naming.InitialContext.init(InitialContext.java:223) [classes.jar:1.6.0_33]

        at javax.naming.InitialContext.<init>(InitialContext.java:197) [classes.jar:1.6.0_33]

        at com.kobie.alchemy.mdb.BackendMDB.init(BackendMDB.java:134) [alchemy-shard1.jar:1.0.120618]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_33]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_33]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_33]

        at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_33]

        at org.jboss.as.ee.component.ManagedReferenceLifecycleMethodInterceptorFactory$ManagedReferenceLifecycleMethodInterceptor.processInvocation(ManagedReferenceLifecycleMethodInterceptorFactory.java:130) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:112) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.ManagedReferenceInterceptorFactory$ManagedReferenceInterceptor.processInvocation(ManagedReferenceInterceptorFactory.java:95) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:161) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:85) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1.create(MessageDrivenComponent.java:79) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponent$1.create(MessageDrivenComponent.java:76) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.pool.AbstractPool.create(AbstractPool.java:60) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.pool.strictmax.StrictMaxPool.get(StrictMaxPool.java:123) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:47) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:202) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:306) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:184) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at javax.jms.MessageListener$$$view62.onMessage(Unknown Source) [jboss-jms-api_1.1_spec-1.0.0.Final.jar:1.0.0.Final]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_33]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_33]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_33]

        at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_33]

        at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at $Proxy118.onMessage(Unknown Source)    at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:278)

        at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:983)

        at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:48)

        at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1113)

        at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_33]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_33]

        at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_33]

    Caused by: java.lang.NoClassDefFoundError: javax/naming/spi/InitialContextFactory

        at java.lang.ClassLoader.defineClass1(Native Method) [classes.jar:1.6.0_33]

        at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631) [classes.jar:1.6.0_33]

        at java.lang.ClassLoader.defineClass(ClassLoader.java:615) [classes.jar:1.6.0_33]

        at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141) [classes.jar:1.6.0_33]

        at org.jboss.modules.ModuleClassLoader.doDefineOrLoadClass(ModuleClassLoader.java:327)

        at org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:391)

        ... 88 more

    Caused by: java.lang.ClassNotFoundException: javax.naming.spi.InitialContextFactory from [Module "activemq:main" from local module loader @1171b26 (roots: /Applications/jboss-as-7.1.1.Final/modules)]

        at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:190)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:468)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:456)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:423)

        at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:398)

        at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:120)

        ... 94 more

     

    ------------------------------------

     

    Once again, thanks for the responses.

  • 5. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    Justin Bertram Master

    Can you attach the module.xml from your ActiveMQ module?

  • 6. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    goldengate001 Newbie

    Ok. Here you go.

     

    <module xmlns="urn:jboss:module:1.0" name="activemq">

        <resources>

            <resource-root path="activemq-all-5.4.2.jar"/>

        </resources>

    </module>

  • 7. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    Justin Bertram Master

    Try this:

     

    <module xmlns="urn:jboss:module:1.0" name="activemq">
        <resources>
            <resource-root path="activemq-all-5.4.2.jar"/>
        </resources>
        <dependencies>
            <module name="javax.api"/>
        </dependencies>
    </module>
    
  • 8. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    goldengate001 Newbie

    Still getting exceptions. Here is the stack trace.

     

    ----------------------------------------

     

    11:40:34,935 ERROR [org.jboss.as.ejb3.tx.CMTTxInterceptor] (Thread-0 (HornetQ-client-global-threads-12182876)) javax.ejb.EJBTransactionRolledbackException: org.apache.activemq.ActiveMQConnectionFactory cannot be cast to javax.jms.ConnectionFactory

    11:40:34,936 ERROR [org.jboss.ejb3.invocation] (Thread-0 (HornetQ-client-global-threads-12182876)) JBAS014134: EJB Invocation failed on component BackendMDB for method public abstract void javax.jms.MessageListener.onMessage(javax.jms.Message): javax.ejb.EJBTransactionRolledbackException: org.apache.activemq.ActiveMQConnectionFactory cannot be cast to javax.jms.ConnectionFactory

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.handleInCallerTx(CMTTxInterceptor.java:139) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:204) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.required(CMTTxInterceptor.java:306) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.processInvocation(CMTTxInterceptor.java:190) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.LoggingInterceptor.processInvocation(LoggingInterceptor.java:59) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.interceptors.AdditionalSetupInterceptor.processInvocation(AdditionalSetupInterceptor.java:43) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.messagedriven.MessageDrivenComponentDescription$5$1.processInvocation(MessageDrivenComponentDescription.java:184) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.TCCLInterceptor.processInvocation(TCCLInterceptor.java:45) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.ViewService$View.invoke(ViewService.java:165) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ee.component.ViewDescription$1.processInvocation(ViewDescription.java:173) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.ProxyInvocationHandler.invoke(ProxyInvocationHandler.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at javax.jms.MessageListener$$$view62.onMessage(Unknown Source) [jboss-jms-api_1.1_spec-1.0.0.Final.jar:1.0.0.Final]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_33]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_33]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_33]

        at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_33]

        at org.jboss.as.ejb3.inflow.MessageEndpointInvocationHandler.doInvoke(MessageEndpointInvocationHandler.java:140) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.as.ejb3.inflow.AbstractInvocationHandler.invoke(AbstractInvocationHandler.java:73) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at $Proxy118.onMessage(Unknown Source)    at org.hornetq.ra.inflow.HornetQMessageHandler.onMessage(HornetQMessageHandler.java:278)

        at org.hornetq.core.client.impl.ClientConsumerImpl.callOnMessage(ClientConsumerImpl.java:983)

        at org.hornetq.core.client.impl.ClientConsumerImpl.access$400(ClientConsumerImpl.java:48)

        at org.hornetq.core.client.impl.ClientConsumerImpl$Runner.run(ClientConsumerImpl.java:1113)

        at org.hornetq.utils.OrderedExecutorFactory$OrderedExecutor$1.run(OrderedExecutorFactory.java:100)

        at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [classes.jar:1.6.0_33]

        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [classes.jar:1.6.0_33]

        at java.lang.Thread.run(Thread.java:680) [classes.jar:1.6.0_33]

    Caused by: java.lang.ClassCastException: org.apache.activemq.ActiveMQConnectionFactory cannot be cast to javax.jms.ConnectionFactory

        at com.kobie.alchemy.mdb.BackendMDB.onMessage(BackendMDB.java:157) [alchemy-shard1.jar:1.0.120618]

        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [classes.jar:1.6.0_33]

        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) [classes.jar:1.6.0_33]

        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) [classes.jar:1.6.0_33]

        at java.lang.reflect.Method.invoke(Method.java:597) [classes.jar:1.6.0_33]

        at org.jboss.as.ee.component.ManagedReferenceMethodInterceptorFactory$ManagedReferenceMethodInterceptor.processInvocation(ManagedReferenceMethodInterceptorFactory.java:72) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.interceptors.UserInterceptorFactory$1.processInvocation(UserInterceptorFactory.java:36) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.InitialInterceptor.processInvocation(InitialInterceptor.java:21) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ee.component.interceptors.ComponentDispatcherInterceptor.processInvocation(ComponentDispatcherInterceptor.java:53) [jboss-as-ee-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.component.pool.PooledInstanceInterceptor.processInvocation(PooledInstanceInterceptor.java:51) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.1.Final.jar:1.1.1.Final]

        at org.jboss.as.ejb3.tx.CMTTxInterceptor.invokeInCallerTx(CMTTxInterceptor.java:202) [jboss-as-ejb3-7.1.1.Final.jar:7.1.1.Final]

        ... 37 more

     

    ----------------------------------------

  • 9. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    goldengate001 Newbie

    I have attached the MDB I am using. Thanks!

  • 10. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    Justin Bertram Master

    I think the problem is that activemq-all-5.4.2.jar contains javax.jms.*.  Your deployment already gets this implicitly from the javaee.api module (see more information about implicity module dependencies here).  I don't think it is appropriate for an application module/jar to package Java EE interfaces.  You can try simply deleting the javax directory from activemq-all-5.4.2.jar or using a different set of ActiveMQ jars in your module to limit it to only what you need.

  • 11. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    goldengate001 Newbie

    Let me try that and get back to you. Thanks!

  • 12. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    goldengate001 Newbie

    Justin,

     

    Not throwing any exceptions now. But not working either.

     

    It was throwing a ClassNotFoundException for javax.jms.topic, for which I added a dependency of javax.jms.

     

    Ran the same set of test. MDB does not seem to move the message to ActiveMQ. Thanks!

  • 13. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    Justin Bertram Master

    It was throwing a ClassNotFoundException for javax.jms.topic, for which I added a dependency of javax.jms.

    What was throwing the CNFE?  Where did you add the dependency?  Your MDB should implicitly depend on the javaee.api module which includes the javax.jms.api module.

     

    Ran the same set of test. MDB does not seem to move the message to ActiveMQ. Thanks!

    Is there a subscriber on the topic to which you're trying to send the message?

  • 14. Re: JBOSS AS 7(HornetQ) to ActiveMQ messaging
    goldengate001 Newbie

    I removed the javax contents from the activemq jar. Modified the modules. Restarted the servers.

    When I deployed the jars, the server log threw an CNFE exception for javax.jms.topic. It was basically trying to process the message already on the topic and threw an exception.

     

    Included javax.jms as the dependency in the activemq module.xml. Restarted the servers and deployed the application.

     

    This time it did not threw an exception but did not write anything else on the log.

     

    Yes, there are active subscribers on the ActiveMQ topic to which I am trying to send the message.

     

    Thanks for your assistance!

1 2 Previous Next