10 Replies Latest reply on May 8, 2006 4:26 PM by John Woodward

    JBPM task integration

    js8523 Novice

      Hi All

      I have a project with similar ake up to dvdstore example (JBPM processes).

      I am trying to start a process (registerInterest), this works succesfully. (@createProcess("matchCustomer")).

      I then have a page containing a list of all the tasks that need to be completed (straight out of the manual, except that instead of assiging the task to a specific actor I launch straight into @StartTask).

      But when I try to start work on the task (the first wait state in the process), the @StartTask annotation is started (and it gathers the taskid and processid properly in the aroundInvoke method).

      But after you call task.start(actorID) in BusinessProcessInterceptor.startTask() it blows up with the following stack trace:

      22:49:19,703 ERROR [Services] problem closing service 'persistence'
      org.jbpm.persistence.JbpmPersistenceException: couldn't flush hibernate session
       at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:166)
       at org.jbpm.svc.Services.close(Services.java:211)
       at org.jbpm.JbpmContext.close(JbpmContext.java:138)
       at org.jboss.seam.core.ManagedJbpmContext.destroy(ManagedJbpmContext.java:80)
       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.seam.util.Reflections.invoke(Reflections.java:13)
       at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:32)
       at org.jboss.seam.contexts.Contexts.callDestroyMethod(Contexts.java:204)
       at org.jboss.seam.contexts.Contexts.destroy(Contexts.java:187)
       at org.jboss.seam.contexts.Lifecycle.flushAndDestroyContexts(Lifecycle.java:239)
       at org.jboss.seam.contexts.Lifecycle.endRequest(Lifecycle.java:164)
       at org.jboss.seam.jsf.SeamPhaseListener.afterPhase(SeamPhaseListener.java:107)
       at org.jboss.seam.jsf.SeamExtendedManagedPersistencePhaseListener.afterPhase(SeamExtendedManagedPersistencePhaseListener.java:52)
       at org.apache.myfaces.lifecycle.LifecycleImpl.informPhaseListenersAfter(LifecycleImpl.java:536)
       at org.apache.myfaces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:359)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:107)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamRedirectFilter.doFilter(SeamRedirectFilter.java:23)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.seam.servlet.SeamExceptionFilter.doFilter(SeamExceptionFilter.java:44)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
       at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
       at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
       at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:54)
       at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:174)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
       at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
       at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:868)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
       at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
       at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
       at java.lang.Thread.run(Thread.java:595)
      Caused by: org.hibernate.HibernateException: instance not of expected entity type: org.jbpm.graph.def.Node
       at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3301)
       at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1330)
       at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
       at org.hibernate.engine.ForeignKeys.getEntityIdentifierIfNotUnsaved(ForeignKeys.java:215)
       at org.hibernate.type.EntityType.getIdentifier(EntityType.java:108)
       at org.hibernate.type.ManyToOneType.isDirty(ManyToOneType.java:221)
       at org.hibernate.type.TypeFactory.findDirty(TypeFactory.java:476)
       at org.hibernate.persister.entity.AbstractEntityPersister.findDirty(AbstractEntityPersister.java:2803)
       at org.hibernate.event.def.DefaultFlushEntityEventListener.dirtyCheck(DefaultFlushEntityEventListener.java:467)
       at org.hibernate.event.def.DefaultFlushEntityEventListener.isUpdateNecessary(DefaultFlushEntityEventListener.java:190)
       at org.hibernate.event.def.DefaultFlushEntityEventListener.onFlushEntity(DefaultFlushEntityEventListener.java:113)
       at org.hibernate.event.def.AbstractFlushingEventListener.flushEntities(AbstractFlushingEventListener.java:195)
       at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:76)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1009)
       at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:164)
       ... 43 more
      


      I am using the jbpm 3.1beta3 and I have checked the hibernate.cfg.xml and jbpm.cfg.xml files against the dvdexample and they are identical (apart from the obvious persistence information).

      The other thing of note is that I have injected some variables into the business process context (but these seam to be correctly placed in the database tables, so I don't see any problem).

      If anybody can point me in the right direction, i'd be thankful.

      James

        • 1. Re: JBPM task integration
          Gavin King Master

          Put a breakpoint in Hibernate src at AbstractEntityPersister:3301 and see what you have got instead of the the expected org.jbpm.graph.de
          f.Node.

          • 2. Re: JBPM task integration
            js8523 Novice

            Hi

            Really bafaling but it is org.jboss.seam.jbpm.Page as I imagine it should be.

            I am using Jbpm beta3.

            As a further note (not sure if useful) the server prints this out after the exception.

            16:15:46,646 INFO [STDOUT] FieldsManager in use = org.jboss.serial.classmetamodel.ReflectionFieldsManager


            There is no other jbpm library anywhere near the classpath.

            Thanks for any help,

            James



            • 3. Re: JBPM task integration
              Gavin King Master

              whoah!

              Sounds like you are using a pageflow as a business process definition!

              They are very, very different things!

              • 4. Re: JBPM task integration
                Gavin King Master

                Business process definition do NOT have nodes.

                • 5. Re: JBPM task integration
                  js8523 Novice

                  Hi Gavin

                  thanks for the fast reply, what is happening is I have a pageflow and a process flow a page is called "match" and a task in my process flow is also called "match" and I imagine it is getting confused when looking up the task.

                  I imagine this is the case, I will try now and post the result.

                  Thanks again,

                  James

                  • 6. Re: JBPM task integration
                    Gavin King Master

                    This seems pretty difficult to believe.

                    More likely you have mixed up the two

                    org.jboss.seam.core.jbpm.xxxxDefinitions

                    settings.

                    • 7. Re: JBPM task integration
                      js8523 Novice

                      Unfortuneatly not as simple as that.

                      I've checked all the obvious stuff, changed the names of the task and page ids but still to no avail.

                      The one thing that could be confusing it is using the pageflow at the same time as trying to complete the task from the process flow, using :

                      @StartTask(pageflow="matchRegistrationInformation")
                      


                      and I am also not doing the classical, assign task to user step either I am jumping from a task assigned to a pool of users straight into trying to execute it.

                      I am debugging currently, to see where I go wrong.

                      James

                      • 8. Re: JBPM task integration
                        js8523 Novice

                        I solved the error listed above by removing the pageflow definition from the @StartTask and performing navigation using faces-config.xml.

                        But I could not pick out the error through my debugging.

                        As I understand it jpdl pageflows are never stored in the persistence, so I presume it is picking up the page jpdl node from the application context (TaskInstance) somehow, but I never figured out when this was heppening.

                        I am also having a bit of a nightmare injecting business process values in the same component that calls @StartTask as the variables aren't initialised until StartTask is called by then the injection process is complete?

                        James



                        • 9. Re: JBPM task integration
                          Gavin King Master

                           

                          "js8523" wrote:
                          I solved the error listed above by removing the pageflow definition from the @StartTask and performing navigation using faces-config.xml.


                          Hmmm. I don't have any example of a task navigation using a jBPM pageflow, so I had better test that.

                          http://jira.jboss.com/jira/browse/JBSEAM-136

                          "js8523" wrote:
                          As I understand it jpdl pageflows are never stored in the persistence, so I presume it is picking up the page jpdl node from the application context (TaskInstance) somehow, but I never figured out when this was heppening.


                          That really seems unlikely.

                          "js8523" wrote:
                          I am also having a bit of a nightmare injecting business process values in the same component that calls @StartTask as the variables aren't initialised until StartTask is called by then the injection process is complete?


                          Business process variables are so too available as soon as the @StartTask method is entered. Check BusinessProcessInterceptor.

                          • 10. Re: JBPM task integration
                            John Woodward Newbie

                            This may be related to this more recent post: http://www.jboss.com/index.html?module=bb&op=viewtopic&t=81736


                            I'm working on an example that would show our issue (it's being reviewed by a couple of folks first, to ensure I don't post something too boneheaded!).

                            j