3 Replies Latest reply on Mar 27, 2009 7:54 AM by Ronald van Kuijk

    Problems with JBPM Ttimer EJB from a simple Web App

    Stefano Ferrante Newbie

      Hi all i have a strange problem to navigate a process from a servlet.

      The servlet is simple , it get as input the id of the process, and the name of transition where it have to go for the next token or node.

      The names transitions's are sended with radio buttons and the values inside them come from iterating the Map : mynode.getLeavingTransitionsMap().

      Now the problem is this exception:

      2009-03-26 11:42:05,463 DEBUG [org.jbpm.graph.def.GraphElement] executing action 'action[MailSender]'
      2009-03-26 11:42:05,463 DEBUG [org.jbpm.graph.exe.Token] token[12252] is locked by token[12252]
      2009-03-26 11:42:05,463 DEBUG [org.hibernate.impl.SessionImpl] initializing proxy: [org.jbpm.graph.node.State#11131]
      2009-03-26 11:42:05,463 DEBUG [org.jbpm.graph.def.GraphElement] event 'timer-create' on 'State(inagenzia)' for 'Token(/)'
      2009-03-26 11:42:05,463 DEBUG [org.jbpm.graph.exe.Token] token[12252] is unlocked by token[12252]
      2009-03-26 11:42:05,463 ERROR [org.jbpm.graph.def.GraphElement] action threw exception: ejb timer entity lookup problem
      org.jbpm.JbpmException: ejb timer entity lookup problem
       at org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory.getTimerEntityHome(EntitySchedulerServiceFactory.java:45)
       at org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory.openService(EntitySchedulerServiceFactory.java:62)
       at org.jbpm.svc.Services.getService(Services.java:177)
       at org.jbpm.svc.Services.getCurrentService(Services.java:98)
       at org.jbpm.svc.Services.getCurrentService(Services.java:89)
       at org.jbpm.scheduler.def.CreateTimerAction.execute(CreateTimerAction.java:79)
       at org.jbpm.graph.def.GraphElement.executeAction(GraphElement.java:284)
       at org.jbpm.graph.def.GraphElement.executeActions(GraphElement.java:241)
       at org.jbpm.graph.def.GraphElement.fireAndPropagateEvent(GraphElement.java:213)
       at org.jbpm.graph.def.GraphElement.fireEvent(GraphElement.java:196)
       at org.jbpm.graph.def.Node.enter(Node.java:371)
       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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
       at org.jbpm.graph.def.Node_$$_javassist_49.enter(Node_$$_javassist_49.java)
       at org.jbpm.graph.def.Transition.take(Transition.java:167)
       at org.jbpm.graph.def.Node.leave(Node.java:479)
       at org.jbpm.graph.exe.ExecutionContext.leaveNode(ExecutionContext.java:155)
       at org.jbpm.graph.node.Decision.execute(Decision.java:194)
       at org.jbpm.graph.def.Node.enter(Node.java:390)
       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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
       at org.jbpm.graph.def.Node_$$_javassist_49.enter(Node_$$_javassist_49.java)
       at org.jbpm.graph.def.Transition.take(Transition.java:167)
       at org.jbpm.graph.def.Node.leave(Node.java:479)
       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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
       at org.jbpm.graph.def.Node_$$_javassist_49.leave(Node_$$_javassist_49.java)
       at org.jbpm.graph.exe.Token.signal(Token.java:223)
       at org.jbpm.graph.exe.Token.signal(Token.java:180)
       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.hibernate.proxy.pojo.javassist.JavassistLazyInitializer.invoke(JavassistLazyInitializer.java:173)
       at org.jbpm.graph.exe.Token_$$_javassist_65.signal(Token_$$_javassist_65.java)
       at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:319)
       at it.test.servlet.CallserServlet.doGet(CallserServlet.java:63)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:690)
       at javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
       at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
       at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
       at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: javax.naming.NameNotFoundException: ejb not bound
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:529)
       at org.jnp.server.NamingServer.getBinding(NamingServer.java:537)
       at org.jnp.server.NamingServer.getObject(NamingServer.java:543)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:267)
       at org.jnp.server.NamingServer.lookup(NamingServer.java:270)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:667)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:774)
       at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:627)
       at javax.naming.InitialContext.lookup(InitialContext.java:351)
       at org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory.lookup(EntitySchedulerServiceFactory.java:54)
       at org.jbpm.scheduler.ejbtimer.EntitySchedulerServiceFactory.getTimerEntityHome(EntitySchedulerServiceFactory.java:43)
       ... 65 more
      



      I tried retrieving the process instance with:
      JbpmContext.getProcessInstance(long);
      JbpmContext.getProcessInstanceForUpdate(long);
      JbpmContext.loadProcessInstance(long);
      

      The exception is thrown in any case, but if i use the console for the same transition, the exception is not thrown. And after that i used the console , i can use the servlet as well and no more exceptions will be thrown, using the signal() o signal(transitionName).

      I don't know how, but seem that there is something not initialized by me in the Servlet , instead the console of JBPM create something that i'm missing.

      here part of the code of the servlet :


      JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
      JbpmContext ctx = jbpmConfiguration.createJbpmContext();
      ProcessInstance pInst = ctx.getProcessInstanceForUpdate(Long.parseLong(id));
      pInst.signal(transitionName);
      



      could anyone help please?.


      Thanks in advance.
      T.



        • 1. Re: Problems with JBPM Ttimer EJB from a simple Web App
          Stefano Ferrante Newbie

          I changed the deploy folder , and from :


          %JBOSS_HOME%\server\default\deploy

          i put my web application war under :

          %JBOSS_HOME%\server\default\deploy\jbpm

          and now no Exception are thrown.

          But i need that my app is out of this folder, .. anyone could explain why the EJB is not available out from the JBPM folder at first time you invoke it?.
          Could be a missing configuration in my web.xml file for the webapp i use as test?.

          Any suggestion will be appreciated :).

          T.


          • 2. Re: Problems with JBPM Ttimer EJB from a simple Web App
            Stefano Ferrante Newbie

            Ok seems i found what i was missing.. a couple of thing :P at last..

            put this in my web.xml (i had to look as first at web.xml of console web-app :) )

             <listener>
             <description>
             Closes the jBPM configuration on servlet context destruction, releasing
             application resources. This listener should appear after the job executor
             launcher to avoid reopening the configuration.
             </description>
             <listener-class>org.jbpm.web.JbpmConfigurationCloser</listener-class>
             </listener>
            
             <resource-ref>
             <description>
             Logical name of the data source that provides connections to the persistence service.
             Must match the hibernate.connection.datasource property in the Hibernate
             configuration file.
             </description>
             <res-ref-name>jdbc/JbpmDataSource</res-ref-name>
             <res-type>javax.sql.DataSource</res-type>
             <res-auth>Container</res-auth>
             </resource-ref>
            
             <resource-ref>
             <description>
             Logical name of the factory that provides JMS connections to the message service.
             Required for processes that contain asynchronous continuations.
             </description>
             <res-ref-name>jms/JbpmConnectionFactory</res-ref-name>
             <res-type>javax.jms.ConnectionFactory</res-type>
             <res-auth>Container</res-auth>
             </resource-ref>
            
             <ejb-ref>
             <description>
             Link to the local entity bean that implements the scheduler service. Required for
             processes that contain timers.
             </description>
             <ejb-ref-name>ejb/TimerEntityBean</ejb-ref-name>
             <ejb-ref-type>Entity</ejb-ref-type>
             <home>org.jbpm.ejb.TimerEntityHome</home>
             <remote>org.jbpm.ejb.TimerEntity</remote>
             </ejb-ref>
            
             <message-destination-ref>
             <description>
             The message service sends job messages to the queue referenced here. To ensure
             this is the same queue from which the JobListenerBean receives messages, the
             message-destination-link element points to a common logical destination, JobQueue.
             </description>
             <message-destination-ref-name>jms/JobQueue</message-destination-ref-name>
             <message-destination-type>javax.jms.Queue</message-destination-type>
             <message-destination-usage>Produces</message-destination-usage>
             <message-destination-link>JobQueue</message-destination-link>
             </message-destination-ref>
            


            and then the jboss-web.xml file.


            Sorry for boring you ^_^..

            T.

            • 3. Re: Problems with JBPM Ttimer EJB from a simple Web App
              Ronald van Kuijk Master

              no problem, not at all... now others that have the same problem can find a solution. So thanks for reporting back