2 Replies Latest reply on Jun 27, 2008 1:40 PM by Seema Gupta

    getInitialContext Error with Tibco Queue Listener

    Seema Gupta Newbie

      Hello Friends,

      I'm trying to listen to the messages on the Tibco Queue. It seems to have proper connection to the server; however, not able to listen to the queue.

      Here is the error message in the log file:

      2008-06-26 17:36:51,296 DEBUG [org.jboss.soa.esb.listeners.message.MessageAwareListener] Courier Exception
      org.jboss.soa.esb.couriers.CourierException: Unable to create Message Consumer
       at org.jboss.internal.soa.esb.couriers.JmsCourier.pickupPayload(JmsCourier.java:422)
       at org.jboss.internal.soa.esb.couriers.JmsCourier.pickup(JmsCourier.java:402)
       at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:232)
       at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:214)
       at org.jboss.soa.esb.listeners.message.MessageAwareListener.waitForEventAndProcess(MessageAwareListener.java:280)
       at org.jboss.soa.esb.listeners.message.MessageAwareListener.doRun(MessageAwareListener.java:248)
       at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle.run(AbstractThreadedManagedLifecycle.java:115)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.jboss.soa.esb.helpers.NamingContextException: Failed to create Naming Context
       at org.jboss.soa.esb.helpers.NamingContextPool.createContext(NamingContextPool.java:358)
       at org.jboss.soa.esb.helpers.NamingContextPool.getContext(NamingContextPool.java:296)
       at org.jboss.soa.esb.helpers.NamingContextPool.getContext(NamingContextPool.java:151)
       at org.jboss.soa.esb.helpers.NamingContextPool.getNamingContext(NamingContextPool.java:402)
       at org.jboss.internal.soa.esb.couriers.JmsCourier.createMessageConsumer(JmsCourier.java:494)
       at org.jboss.internal.soa.esb.couriers.JmsCourier.pickupPayload(JmsCourier.java:414)
       ... 7 more
      Caused by: javax.naming.NoInitialContextException: Cannot instantiate class: com.tibco.tibjms.TibjmsQueueConnectionFactory [Root exception is java.lang.ClassCastException: com.tibco.tibjms.TibjmsQueueConnectionFactory]
       at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:657)
       at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
       at javax.naming.InitialContext.init(InitialContext.java:223)
       at javax.naming.InitialContext.<init>(InitialContext.java:197)
       at org.jboss.soa.esb.helpers.NamingContextPool.createContext(NamingContextPool.java:338)
       ... 12 more
      Caused by: java.lang.ClassCastException: com.tibco.tibjms.TibjmsQueueConnectionFactory
       at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:654)
       ... 16 more
      


      My jboss-esb.xml has this provider information:
       <jms-provider name="JBossMQ"
       connection-factory="ConnectionFactory"
       jndi-context-factory="com.tibco.tibjms.TibjmsQueueConnectionFactory"
       jndi-URL="tibd3.abc.com" >
      
       <jms-bus busid="EsbChannel">
       <jms-message-filter
       dest-type="QUEUE"
       dest-name="queue/DEVHCL.IF.TRACE.PUBLISH"
       selector="source='fromHelloworldFTPAction'"
       />
       </jms-bus>
      
       </jms-provider>
      



      This is my "action" from jboss-esb.xml:

       <actions>
       <action name="action1"
       class="org.jboss.soa.esb.ftpaction.MyJMSListenerAction"
       process="displayMessage"
       />
       </actions>
      


      And this is "MyJMSListenerAction.java":

      package org.jboss.soa.esb.ftpaction;
      
      import org.jboss.soa.esb.actions.AbstractActionLifecycle;
      import org.jboss.soa.esb.helpers.ConfigTree;
      import org.jboss.soa.esb.message.Message;
      
      import com.tibco.tibjms.TibjmsQueueConnectionFactory;
      
      public class MyJMSListenerAction extends AbstractActionLifecycle
      {
      
       protected ConfigTree _config;
      
       public MyJMSListenerAction(ConfigTree config) { _config = config; }
      
      
       public Message displayMessage(Message message) throws Exception{
      
      
       System.out.println("INSIDE MyJMSListenerAction:::displayMessage ");
      
       System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
       System.out.println("Body: " + message.getBody().get()) ;
       System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
       return message;
      
       }
      
      
      }
      



      My JNDI.properties looks like this:

      java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
      java.naming.provider.url=jnp://tibd33.abc.com:7222
      java.naming.factory.url.pkgs=org.jboss.naming
      java.naming.factory.url.pkgs=org.jnp.interfaces
      


      Can somebody please let me know what's wrong with my implementation? There is definitely something wrong with the "Context". I'm not getting initialContext anywhere in my code. Do I need to? if yes, how?

      Thanks for all the help.
      Regards.

        • 1. Re: getInitialContext Error with Tibco Queue Listener
          Kevin Conner Master

           

          "iamnew2jboss" wrote:

          My jboss-esb.xml has this provider information:
           <jms-provider name="JBossMQ"
           connection-factory="ConnectionFactory"
           jndi-context-factory="com.tibco.tibjms.TibjmsQueueConnectionFactory"
           jndi-URL="tibd3.abc.com" >
          
           <jms-bus busid="EsbChannel">
           <jms-message-filter
           dest-type="QUEUE"
           dest-name="queue/DEVHCL.IF.TRACE.PUBLISH"
           selector="source='fromHelloworldFTPAction'"
           />
           </jms-bus>
          
           </jms-provider>
          


          The jndi-context attribute is incorrect. This should refer to the JNDI naming context factory and not the QueueConnectionFactory.

          Kev

          • 2. Re: getInitialContext Error with Tibco Queue Listener
            Seema Gupta Newbie

            Thanks Kevin.

            I did modify jboss-esb.xml as below:

             <jms-provider name="JBossMQ"
             connection-factory="ConnectionFactory"
             jndi-context-factory="com.tibco.tibjms.naming.TibjmsInitialContextFactory"
             jndi-URL="tibd3.abc.com:7222" >
            
             <jms-bus busid="autodeskEsbChannel">
             <jms-message-filter
             dest-type="QUEUE"
             dest-name="queue/DEVHCL.IF.TRACE.PUBLISH"
             selector="source='fromHelloworldFTPAction'"
             />
             </jms-bus>
            
             </jms-provider>
            


            And now, I'm getting following error:

            org.jboss.soa.esb.couriers.CourierException: Unable to create Message Consumer
             at org.jboss.internal.soa.esb.couriers.JmsCourier.pickupPayload(JmsCourier.java:422)
             at org.jboss.internal.soa.esb.couriers.JmsCourier.pickup(JmsCourier.java:402)
             at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:232)
             at org.jboss.internal.soa.esb.couriers.TwoWayCourierImpl.pickup(TwoWayCourierImpl.java:214)
             at org.jboss.soa.esb.listeners.message.MessageAwareListener.waitForEventAndProcess(MessageAwareListener.java:280)
             at org.jboss.soa.esb.listeners.message.MessageAwareListener.doRun(MessageAwareListener.java:248)
             at org.jboss.soa.esb.listeners.lifecycle.AbstractThreadedManagedLifecycle.run(AbstractThreadedManagedLifecycle.java:115)
             at java.lang.Thread.run(Thread.java:595)
            Caused by: org.jboss.soa.esb.helpers.NamingContextException: Failed to create Naming Context
             at org.jboss.soa.esb.helpers.NamingContextPool.createContext(NamingContextPool.java:358)
             at org.jboss.soa.esb.helpers.NamingContextPool.getContext(NamingContextPool.java:296)
             at org.jboss.soa.esb.helpers.NamingContextPool.getContext(NamingContextPool.java:151)
             at org.jboss.soa.esb.helpers.NamingContextPool.getNamingContext(NamingContextPool.java:402)
             at org.jboss.internal.soa.esb.couriers.JmsCourier.createMessageConsumer(JmsCourier.java:494)
             at org.jboss.internal.soa.esb.couriers.JmsCourier.pickupPayload(JmsCourier.java:414)
             ... 7 more
            Caused by: javax.naming.OperationNotSupportedException: Not supported
             at com.tibco.tibjms.naming.TibjmsContext.list(TibjmsContext.java:1030)
             at com.tibco.tibjms.naming.TibjmsContext.list(TibjmsContext.java:509)
             at javax.naming.InitialContext.list(InitialContext.java:395)
             at org.jboss.soa.esb.helpers.NamingContextPool.createContext(NamingContextPool.java:342)
             ... 12 more



            "javax.naming.OperationNotSupportedException: Not supported": What does that mean?

            Thanks again.
            Regards,