7 Replies Latest reply on Dec 11, 2006 4:22 PM by beve

    JMSRouter issue

    beve

      Hi,

      had a problem getting the JMSRouter to work. The first problem i ran into was the following:

      15:35:47,509 ERROR [ActionProcessingPipeline] Premature termination of action processing pipeline [Ljava.lang.String;@1f82ab4].
      ActionProcessor [org.jboss.soa.esb.actions.routing.JMSRouter] method not found
      java.lang.NoSuchMethodException: org.jboss.soa.esb.actions.routing.JMSRouter.<init>(org.jboss.soa.esb.helpers.ConfigTree)
       at java.lang.Class.getConstructor0(Class.java:2647)
       at java.lang.Class.getConstructor(Class.java:1629)
       at org.jboss.soa.esb.listeners.message.ActionProcessingPipeline.run(ActionProcessingPipeline.java:75)
       at java.lang.Thread.run(Thread.java:595)
      


      I added the missing constructor as follows:

      private ConfigTree configTree;
      
      public JMSRouter(String actionName, List<KeyValuePair> properties) throws ConfigurationException, NamingException, JMSException {
       createJMSRouter( properties );
      }
      
      public JMSRouter(ConfigTree configTree) throws NamingException, JMSException, ConfigurationException
      {
       this.configTree = configTree;
      
       List<KeyValuePair> properties = new ArrayList<KeyValuePair>();
       ConfigTree[] confProperties = configTree.getAllChildren();
       for (int x = 0; x < confProperties.length; x++)
       {
       String attrName = confProperties[x].getAttribute("name");
       String attrValue = confProperties[x].getAttribute("value");
       properties.add( new KeyValuePair( attrName, attrValue ) );
       }
       createJMSRouter( properties );
       }
      
       private void createJMSRouter(List<KeyValuePair> properties) throws ConfigurationException, NamingException, JMSException
       {
       this.properties = properties;
       String queueName = KeyValuePair.getValue("jndiName", properties);
       if(queueName == null) {
       throw new ConfigurationException("JMSRouter must specify a 'jndiName' property.");
       }
      
       queueSetup = new JMSSendQueueSetup(queueName);
       }
      

      After this was added a got the following exception :
      19:19:53,401 ERROR [ActionProcessingPipeline] Process method threw Exception
      java.lang.reflect.InvocationTargetException
       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.jboss.soa.esb.listeners.message.ActionProcessingPipeline.run(ActionProcessingPipeline.java:89)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: java.lang.NullPointerException
       at org.jboss.soa.esb.actions.routing.JMSRouter.process(JMSRouter.java:137)
       ... 6 more
      

      Please note that the line numbers may not match the current svn code, but line 137 is the following line in my code(JMSRouter process method):
      Object oCurr = ActionUtils.getTaskObject(message);
      if(!(oCurr instanceof Serializable)) {
       throw new ActionProcessingException("Cannot send Object [" + oCurr.getClass().getName() + "] to destination [" + queueSetup.queueName + "]. Object must be serializable.");
      }
      

      When I made the following change to FileGatewayListener.PackageFileContents things seem to work:
      public Message process (Object obj) throws Exception
       {
       if (! (obj instanceof File))
       throw new Exception ("Object must be instance of File");
      
       Message message = MessageFactory.getInstance().getMessage();
       ActionUtils.setTaskObject(message, getFileContent((File)obj));
       //message.getBody().setContents(getFileContent((File)obj));
       return message;
       }
      

      The bold line is the one I added and the line that is commented out is the original.
      Don't know if this is a valid solution but it seems to work for me.


      /Daniel


        • 1. Re: JMSRouter issue
          beve

          Sorry, but I think I spoke to soon...

          Looks like the change I make in FileGatewayListener.PackageFileContents avoided the NullPointerException but the message is now empty which is not really what I wanted:(
          If I just add

          public Message process (Object obj) throws Exception
           {
           if (! (obj instanceof File))
           throw new Exception ("Object must be instance of File");
          
           Message message = MessageFactory.getInstance().getMessage();
          
          ActionUtils.setTaskObject(message, getFileContent((File)obj));
          
           message.getBody().setContents(getFileContent((File)obj));
           return message;
           }
          
          

          The message is displayed when I add a NotifyConsole and the message looks alright when I retreive it from the queue. But this code does not look right. Any chance you guys have time to take a look at this?

          thanks,

          /Daniel

          • 2. Re: JMSRouter issue
            kurtstam

            Hi Daniel,

            What codebase are you using. I'm trying to compare it to what's currently in the trunk, and I'm having a hard time. Can you try it with the current trunk code? If it still fails can you add the steps to reproduce and add it to jira?

            thx,

            --Kurt

            • 3. Re: JMSRouter issue
              beve

              Hi Kurt,

              I'm been checkin out http://anonsvn.jboss.org/repos/labs/labs/jbossesb/trunk, and the revision I've got is 8184.

              Is this the correct code base to use? Let me know which one I should be using and I will try the changes with that code and if the problem still exist I'll add it to jira.

              thanks,

              /Daniel

              • 4. Re: JMSRouter issue
                kurtstam

                OK I was looking in the wrong file, you've got the right code. Although my svn (https) on goes to 8180. Not sure what's going on there. Can you make sure that in your jbossesb-properties.xml you have the lines:





                This was recently changed to support other mq-products.

                Do another update because I misnamed that variable and just fixed it:
                org.jboss.soa.esb.jndi.server.context.factory
                (not org.jboss.soa.esb.jndi.server.connection.factory)

                thx,

                --Kurt

                • 5. Re: JMSRouter issue
                  kurtstam

                  Sorry let's try that again:

                  <properties name="core">
                   <property name="org.jboss.soa.esb.jndi.server.context.factory" value="org.jnp.interfaces.NamingContextFactory"/>
                   <property name="org.jboss.soa.esb.jndi.server.url" value="localhost"/>
                   <property name="org.jboss.soa.esb.persistence.connection.factory" value="org.jboss.internal.soa.esb.persistence.format.MessageStoreFactoryImpl"/>
                   </properties>
                  



                  • 6. Re: JMSRouter issue
                    beve

                    Yepp, when I update that file I see the change you made.

                    When I run svn info jbossesb-properties.xml the revision is:


                    Revision: 8186


                    So, I'll try this out tomorrow and if it looks like its working I'll add a jira task for it.

                    thanks,

                    /Daniel

                    • 7. Re: JMSRouter issue
                      beve

                      Hi Kurt,

                      just wanted to let you know that I created a jira report http://jira.jboss.com/jira/browse/JBESB-275 for this issue.
                      I attatched a test class and also the modifications that I made to JSMRouter in case they could be of any help.

                      /Daniel