3 Replies Latest reply on Sep 28, 2007 7:46 PM by Kurt Stam

    Using JBoss ESB plugin to consume Oracle AQ JMS

    Alexandre Nodari Newbie

      Hi,

      I am trying to consume JMS messages from an Oracle AQ system, but I'm using only JBoss AS 4.2 instead of JBoss ESB. I got the plugin used in JBoss ESB sample hello_world_action and created the following configuration:

      JBoss AS 4.2 (with JBoss MQ)
      org.jboss.soa.esb.oracle.aq-4.2.jar in the lib directory
      asm.jar, cglib.jar, mockejb.jar, aqapi.jar, ojdbc14.jar also in the lib directory

      In the jms-ds.xml configuration file I createds a new JMS Provider pointing to the initial context factory in the JBoss ESB plugin.
      In the standardjboss.xml configuration file I created a new invoker=proxy-binding and a new container pointing to the new JMS Provider above.

      When I deploy a MDB using this new JMS Provider, the initial context factory is activated and pull all the JMS Queues from Oracle AQ to his context without problems. But when the MDB tries to find a queue in this contexts I get the following exception:

      org.mockejb.MethodNotImplementedException: Method getEnvironment() not implemented by the class org.mockejb.jndi.MockContext
      at org.mockejb.jndi.MockContext.throwMethodNotImplemented(MockContext.java:834)
      at org.mockejb.jndi.MockContext.getEnvironment(MockContext.java:333)
      at org.mockejb.jndi.MockContext$$FastClassByCGLIB$$8f78c5.invoke()
      at net.sf.cglib.reflect.FastMethod.invoke(FastMethod.java:53)
      at org.mockejb.interceptor.InterceptorInvoker$CglibMethodInvoker.intercept(InterceptorInvoker.java:95)
      at org.mockejb.interceptor.InvocationContext.proceed(InvocationContext.java:177)
      at org.mockejb.interceptor.InterceptorInvoker.invoke(InterceptorInvoker.java:53)
      at org.mockejb.interceptor.InterceptableProxy.intercept(InterceptableProxy.java:58)
      at $javax.naming.Context$$EnhancerByCGLIB$$83c6105b.getEnvironment()
      at javax.naming.InitialContext.getEnvironment(InitialContext.java:484)
      at javax.naming.InitialContext.getEnvironment(InitialContext.java:484)
      at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:298)
      at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:585)
      at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
      at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
      at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
      at java.lang.Thread.run(Thread.java:595)

      I read in the JBoss ESB hello_world_action sample that the mockejb.jar is needed because of a difference in the registration of the queues (JNDI in JBoss, LDAP in Oracle) but i didn't manage to make the mockejb solution work.

      Any clues are welcome :-)

      Thanks in advance,

        • 1. Re: Using JBoss ESB plugin to consume Oracle AQ JMS
          Kurt Stam Master

          Hi Nodari,

          Pretty creative :). And I think you've got it pretty much working. All you have to do is supply a patch to MockEJB when you fix up the following code:

          /**
           328 * Not implemented
           329 * @see javax.naming.Context#getEnvironment()
           330 */
           331 public Hashtable getEnvironment() throws NamingException {
           332
           333 throwMethodNotImplemented("getEnvironment()");
           334 return null;
           335 }


          http://mockejb.cvs.sourceforge.net/mockejb/mockejb/src/org/mockejb/jndi/MockContext.java?revision=1.14&view=markup

          Cheers,

          --Kurt

          • 2. Re: Using JBoss ESB plugin to consume Oracle AQ JMS
            Alexandre Nodari Newbie

            Thanks Kurt,

            It really got a little further with just a simple patch using a HashMap in mockejb. But now I got this exception:

            oracle.jms.AQjmsException: JMS-102: Feature not supported
            at oracle.jms.AQjmsError.throwEx(AQjmsError.java:288)
            at oracle.jms.AQjmsConnection.createConnectionConsumer(AQjmsConnection.java:1187)
            at org.jboss.resource.adapter.jms.inflow.JmsServerSessionPool.setupConsumer(JmsServerSessionPool.java:262)
            at org.jboss.resource.adapter.jms.inflow.JmsServerSessionPool.start(JmsServerSessionPool.java:91)
            at org.jboss.resource.adapter.jms.inflow.JmsActivation.setupSessionPool(JmsActivation.java:536)
            at org.jboss.resource.adapter.jms.inflow.JmsActivation.setup(JmsActivation.java:309)
            at org.jboss.resource.adapter.jms.inflow.JmsActivation$SetupActivation.run(JmsActivation.java:585)
            at org.jboss.resource.work.WorkWrapper.execute(WorkWrapper.java:204)
            at org.jboss.util.threadpool.BasicTaskWrapper.run(BasicTaskWrapper.java:275)
            at EDU.oswego.cs.dl.util.concurrent.PooledExecutor$Worker.run(PooledExecutor.java:743)
            at java.lang.Thread.run(Thread.java:595)

            I read in the J2EE 1.4 documentation that the method createConnectionConsumer on the interface QueueConnection is optional:

            createConnectionConsumer

            public ConnectionConsumer createConnectionConsumer(Destination destination, String messageSelector, ServerSessionPool sessionPool, int maxMessages) throws JMSException

            Creates a connection consumer for this connection (optional operation). This is an expert facility not used by regular JMS clients.


            Do you know if there is another configuration of JBoss to use another kind of creation for consumer connections?

            Thanks in advance (again :-),

            • 3. Re: Using JBoss ESB plugin to consume Oracle AQ JMS
              Kurt Stam Master

              Yeah, OracleAQ does not implement all the features, I think your best bet is to write straight JMS code, so you can avoid using non-supported features, or you can use JBossESB as a bridge to your app. JBossESB is highly pluggable so you can make it very light weight.

              Let me know how you fare.

              --Kurt