5 Replies Latest reply on Feb 6, 2006 2:59 PM by George Ilias

    Task-node execution & JMS problem

    George Ilias Newbie

      Hello,

      I have been working with Jbpm a while now until i came across this weird phenomenon..
      In my workflow there are 2 task-nodes one after the other :

      <task-node name="AdminApproves">
       <task name="admin approves" swimlane="admin" >
       <event type="task-create">
       <action class="com.adminsys.action.SetupGroupTaskAH" />
       </event>
       </task>
       <transition name="tr1" to="boss approves"></transition>
       </task-node>
      
       <task-node name="boss approves">
      
       <task name="gilias approve" swimlane="admin">
       <event type="task-create">
       <action class="com.adminsys.action.SetupGroupTaskAH" />
       </event>
       </task>
       <transition name="tr1" to="end"></transition>
       </task-node>


      In the actionhandler , a JMS message is constructed and sent to a queue binded in JBoss' JNDI using a JMS producer class.
      After some functionality, another JMS message is sent (in another queue) which signals that the task was completed and is supposed to continue the execution.
      The MDB that listens to this queue opens a JBPM session and tries to retrieve the task instance of the task that is waiting (described in the message), so that it can call taskInstance.end();.

      So the problem is the following: If i call the taskInstance.end() then the execution continues with transition to the next task ,and therefore trying to send another JMS message, so i get a
      com.adminsys.util.ServiceLocatorException: javax.naming.NameNotFoundException: jms not bound


      I know it's not clearly a JBPM issue but i dont know who else to refer to.
      Can anyone please help ? Am i missing out sth here ?

      Any help and suggestions are welcome.

      Thanks in advace,
      George

        • 1. Re: Task-node execution & JMS problem
          Alejandro Guizar Master

          What's bound to the name jms? The connection factory, the queue...?

          • 2. Re: Task-node execution & JMS problem
            George Ilias Newbie

            It is the connection factory...
            Actually there are two queues declared and one connection factory.As soon as it goes for the lookup of the connection factory in the JNDI, it throws the forementioned exception.
            Do you think the problem comes from that there is only one connection factory?
            I read somewhere that declaring the connectionfactory in the jboss-web.xml with the value java:/JmsXA indicates that this QueueConnectionFactory participates in distributed transactions. Does it have anything do to with it?

            Thanks


            • 3. Re: Task-node execution & JMS problem
              Alejandro Guizar Master

              Did you change the name bound to the connection factory?

              Note that the local factory is by default bound to ConnectionFactory whereas the XA factory is bound to XAConnectionFactory, best for remote JMS sessions. These factories correspond to the UIL2 invocation layer.

              The counterparts in the java: namespace (java:ConnectionFactory and java:XAConnectionFactory) are bound by the fast in-VM invocation layer.

              • 4. Re: Task-node execution & JMS problem
                George Ilias Newbie

                Alex thank you for your response.

                Yes, i declare two names for the same connection factory and i have tried all the different combinations i could think of, but still i get the same error...

                javax.naming.NameNotFoundException: jms not bound

                Here is the xdoclet code for the web.xml and jboss-web.xml,if you can get any ideas :)
                That were the most probable settings to have worked i think
                ...
                 * @web.resource-ref
                 * name="jms/TaskWaitingUserQueue"
                 * type="javax.jms.Queue"
                 * auth="Container"
                 *
                 * @web.resource-ref
                 * name="jms/EvaluatedTasksQueue"
                 * type="javax.jms.Queue"
                 * auth="Container"
                 *
                 * @jboss.resource-ref
                 * res-ref-name="jms/TaskWaitingUserQueue"
                 * jndi-name="queue/TaskWaitingUserQueue"
                 *
                 * @jboss.resource-ref
                 * res-ref-name="jms/EvaluatedTasksQueue"
                 * jndi-name="queue/EvaluatedTasksQueue"
                 *
                 * @web.resource-ref
                 * name="jms/MyXAQueueConnectionFactoryA"
                 * type="javax.jms.QueueConnectionFactory"
                 * auth="Container"
                 *
                 * @jboss.resource-ref
                 * res-ref-name="jms/MyXAQueueConnectionFactoryA"
                 * jndi-name="java:/JmsXA"
                 *
                 * @web.resource-ref
                 * name="jms/MyXAQueueConnectionFactoryB"
                 * type="javax.jms.QueueConnectionFactory"
                 * auth="Container"
                 *
                 * @jboss.resource-ref
                 * res-ref-name="jms/MyXAQueueConnectionFactoryB"
                 * jndi-name="java:/JmsXA"
                ...
                


                I am sure that the problem exists because the onMessage() method has not exited before the lookup is done again. I ve tried to set the session
                in client-acknowledge mode
                session = connection.createSession(true, Session.CLIENT_ACKNOWLEDGE);


                and then acknowledge the message inside the onMessage():

                ...
                TaskWaitingDTO task = (TaskWaitingDTO) obj;
                //End task of process instance that is waiting.
                 String pid = task.getProcessID();
                 message.acknowledge();
                 ProcessExecution p = new ProcessExecution();
                 p.endTaskOfProcess(task);
                 System.out.println("[TaskEvaluatedBean] now exiting..");
                ...
                


                ..but that doesn't work either.
                Please, if you have any ideas i d be more than thankful.. i m stack here since Sunday!


                • 5. Re: Task-node execution & JMS problem
                  George Ilias Newbie

                  It finally worked!
                  The problem was that the jndi references to the JMS queue and factory should
                  have also been made at the MDB so as to be retrieved when the asynchronous execution thread would start ! With the X-Doclet like this :

                  * @ejb.resource-ref
                   * res-ref-name="jms/TaskWaitingUserQueue"
                   * res-type="javax.jms.Queue"
                   * res-auth="Container"
                   *
                   * @jboss.resource-ref
                   * res-ref-name="jms/TaskWaitingUserQueue"
                   * jndi-name="queue/TaskWaitingUserQueue"
                   *
                   * @ejb.resource-ref
                   * res-ref-name="jms/MyXAQueueConnectionFactory"
                   * res-type="javax.jms.QueueConnectionFactory"
                   * res-auth="Container"
                   *
                   * @jboss.resource-ref
                   * res-ref-name="jms/MyXAQueueConnectionFactory"
                   * jndi-name="java:/JmsXA"
                  


                  That was all.. :S