7 Replies Latest reply on Nov 28, 2010 12:39 PM by Edward Odufuwa

    Process flush trying to save UnpersistableInstance

    Asa Colson Newbie


      It appears something is going wrong here. Hibernate is throwing an exception because it can't persist a UnpersistableInstance. I assume an unpersitable instance shouldn't get to this point.

      aused by: org.hibernate.HibernateException: instance not of expected entity type: org.jbpm.context.exe.variableinstance.UnpersistableInstance is not a: org.jbpm.context.exe.VariableInstance
       at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3583)
       at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1347)
       at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)
       at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:487)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:84)
       at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)
       at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)
       at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)
       at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:218)
       at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
       at org.hibernate.engine.Cascade.cascadeCollectionElements(Cascade.java:296)
       at org.hibernate.engine.Cascade.cascadeCollection(Cascade.java:242)
       at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:219)
       at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)
       at org.hibernate.engine.Cascade.cascade(Cascade.java:130)
       at org.hibernate.event.def.AbstractFlushingEventListener.cascadeOnFlush(AbstractFlushingEventListener.java:131)
       at org.hibernate.event.def.AbstractFlushingEventListener.prepareEntityFlushes(AbstractFlushingEventListener.java:122)
       at org.hibernate.event.def.AbstractFlushingEventListener.flushEverythingToExecutions(AbstractFlushingEventListener.java:65)
       at org.hibernate.event.def.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:26)
       at org.hibernate.impl.SessionImpl.flush(SessionImpl.java:1000)
       at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:187)
       ... 46 more
      
      


      Asa


        • 1. Re: Process flush trying to save UnpersistableInstance
          Damian Harvey Master

          I am also getting this. It spits out over 1,000,000 characters of stacktrace, taking over my Eclipse console. Nice.

          Did you get a solution? I'm guessing that I'm doing something stupid in my process.

          Cheers,

          Damian.

          • 2. Re: Process flush trying to save UnpersistableInstance
            Ronald van Kuijk Master

            do you try to persist a custom type in jBPM?

            • 3. Re: Process flush trying to save UnpersistableInstance
              Damian Harvey Master

              Oops. Yes I was trying to outject the Seam message bundle into the business process context so I could set an i18n task description.

              @In @Out(scope=ScopeType.BUSINESS_PROCESS)
              private Map<String, String> messages;


              I'll create a taskMetadataBean (or similar) and populate it beforehand instead. Unless there is a better way??

              What I wanted to do in my task was something like this:
              <task name="inspectRateRequest" description="#{messages['contract.noRateFound.TaskDesc']}">


              Cheers,

              Damian.

              • 4. Re: Process flush trying to save UnpersistableInstance
                Asa Colson Newbie

                I solved all of these problems by making sure I didn't outject in BusienssProcessScope anything that wasn't serializable. It appears the functionality exists for JBPM to not try to persist non-serializable variables but it also appears that seam is going around this functionality when outjected BP process variables are inserted into the BP.

                Asa

                • 5. Re: Process flush trying to save UnpersistableInstance
                  Damian Harvey Master

                  What is the best way to pass metadata into the task? Creating a taskMetaData bean doesn't work as I can't then use task.variables (can't ClassLoad the Bean). I've gone back to outjecting Strings with the data I need (eg. i18n descriptions, primary keys, etc;)

                  Thanks,

                  Damian.

                  • 6. Re: Process flush trying to save UnpersistableInstance
                    Asa Colson Newbie



                    What ever you add to the business process context has to be serializable. The business process engine saves the entire context to the database so that it can be resurrected at any time. We are counting on this capability for our fail over contingency. You need to come up with a strategy that a fully functional context can be serialized out and remarshalled and function as if nothing had happened. You need provide enough serialized information for the reinstantiation of non-serializable objects and make your code capable of doing the reinstantiation.

                    Asa

                    • 7. Re: Process flush trying to save UnpersistableInstance
                      Edward Odufuwa Newbie

                      I  using Mule 2.2 and jBPM 3.2.7. And at the end of the process during  persisting  the variable instance within the process I get the following  errors

                       

                      ERROR  2010-11-28 15:23:41,515 [jBpmConnector.dispatcher.1]  org.mule.DefaultExceptionStrategy: Caught exception in Exception  Strategy: variable 'incoming' in 'TokenVariableMap20224a'  contains 'ACKNOWLEDGED': type 'java.lang.String' is unpersistable  according to the jbpm.varmapping.xml configuration

                      org.jbpm.JbpmException:  variable 'incoming' in 'TokenVariableMap20224a' contains  'ACKNOWLEDGED': type 'java.lang.String' is unpersistable according to  the jbpm.varmapping.xml configuration

                            at org.jbpm.svc.save.CheckUnpersistableVariablesOperation.save(CheckUnpersistableVariablesOperation.java:61)

                            at org.jbpm.svc.Services.save(Services.java:164)

                            at org.jbpm.JbpmContext.save(JbpmContext.java:427)

                            at org.mule.transport.bpm.jbpm.Jbpm.startProcess(Jbpm.java:152)

                            at org.mule.transport.bpm.ProcessMessageDispatcher.processAction(ProcessMessageDispatcher.java:164)

                            at org.mule.transport.bpm.ProcessMessageDispatcher.doDispatch(ProcessMessageDispatcher.java:69)

                            at org.mule.transport.AbstractMessageDispatcher$Worker.run(AbstractMessageDispatcher.java:262)

                            at org.mule.work.WorkerContext.run(WorkerContext.java:310)

                            at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)

                            at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)

                            at java.lang.Thread.run(Unknown Source)

                       

                       

                      **************

                       

                      why would java.lang.String be an instanceof UnpersistableInstance?

                      Where will have defined?

                       

                      I have reviewed the jbpm.varmapping.xml

                       

                      PS: i have also updated an existing thread at http://community.jboss.org/message/573273#573273

                       

                       

                      help??

                       

                       

                      Hi All,

                       

                      Further  investigation - i decided to remove all the  variable i have in the  context before completing the process - just to  confrim if my process  will actuall end.

                       

                      Bad news - i get the following errors ...

                       

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: >>>   container of the   variables{MULE_SESSION=SUQ9NTE4Yzg1ZTQtZmIwYi0xMWRmLTgyYmItODFiZTcyODU0NjA4,   message= order placed!, incoming=ACKNOWLEDGED,   incomingSource=ProductOrderRequest,   productOrderRequest=com.bt.hqns.esb.message.ProductOrder@2219b4,   MULE_ENCODING=UTF-8,   MULE_CORRELATION_ID=518c85e3-fb0b-11df-82bb-81be72854608,   MULE_ENDPOINT=bpm://ProcessProductOrder,   submitWLR3FOStatus=ACKNOWLEDGED,   MULE_ORIGINATING_ENDPOINT=ProductOrderRequest}

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'MULE_SESSION' with value   'SUQ9NTE4Yzg1ZTQtZmIwYi0xMWRmLTgyYmItODFiZTcyODU0NjA4'

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'message' with value 'order placed!'

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'incoming' with value 'ACKNOWLEDGED'

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'incomingSource' with value 'ProductOrderRequest'

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'productOrderRequest' with value   'com.bt.hqns.esb.message.ProductOrder@2219b4'

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'MULE_ENCODING' with value 'UTF-8'

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'MULE_CORRELATION_ID' with value '518c85e3-fb0b-11df-82bb-81be72854608'

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'MULE_ENDPOINT' with value 'bpm://ProcessProductOrder'

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'submitWLR3FOStatus' with value 'ACKNOWLEDGED'

                      INFO    2010-11-28 16:19:50,015 [jBpmConnector.dispatcher.1]   com.xxx.bpm.actions.RemoveAllVaribaleActionHandler: Removing variable   'MULE_ORIGINATING_ENDPOINT' with value 'ProductOrderRequest'

                      ERROR   2010-11-28 16:19:50,046 [jBpmConnector.dispatcher.1]   org.mule.DefaultExceptionStrategy: Caught exception in Exception   Strategy: instance not of expected entity type:   org.jbpm.context.exe.variableinstance.UnpersistableInstance is not a:   org.jbpm.context.exe.VariableInstance

                      org.hibernate.HibernateException:   instance not of expected entity type:   org.jbpm.context.exe.variableinstance.UnpersistableInstance is not a:   org.jbpm.context.exe.VariableInstance

                            at org.hibernate.persister.entity.AbstractEntityPersister.getSubclassEntityPersister(AbstractEntityPersister.java:3629)

                            at org.hibernate.impl.SessionImpl.getEntityPersister(SessionImpl.java:1347)

                            at org.hibernate.engine.ForeignKeys.isTransient(ForeignKeys.java:180)

                            at org.hibernate.event.def.AbstractSaveEventListener.getEntityState(AbstractSaveEventListener.java:512)

                            at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.performSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:80)

                            at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)

                            at org.hibernate.impl.SessionImpl.fireSaveOrUpdate(SessionImpl.java:507)

                            at org.hibernate.impl.SessionImpl.saveOrUpdate(SessionImpl.java:499)

                            at org.hibernate.engine.CascadingAction$1.cascade(CascadingAction.java:218)

                            at org.hibernate.engine.Cascade.cascadeToOne(Cascade.java:268)

                            at org.hibernate.engine.Cascade.cascadeAssociation(Cascade.java:216)

                            at org.hibernate.engine.Cascade.cascadeProperty(Cascade.java:169)

                            at org.hibernate.engine.Cascade.cascade(Cascade.java:130)

                            at org.hibernate.event.def.AbstractSaveEventListener.cascadeBeforeSave(AbstractSaveEventListener.java:431)

                            at org.hibernate.event.def.AbstractSaveEventListener.performSaveOrReplicate(AbstractSaveEventListener.java:265)

                            at org.hibernate.event.def.AbstractSaveEventListener.performSave(AbstractSaveEventListener.java:181)

                            at org.hibernate.event.def.AbstractSaveEventListener.saveWithGeneratedId(AbstractSaveEventListener.java:107)

                            at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.saveWithGeneratedOrRequestedId(DefaultSaveOrUpdateEventListener.java:187)

                            at org.hibernate.event.def.DefaultSaveEventListener.saveWithGeneratedOrRequestedId(DefaultSaveEventListener.java:33)

                            at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.entityIsTransient(DefaultSaveOrUpdateEventListener.java:172)

                            at org.hibernate.event.def.DefaultSaveEventListener.performSaveOrUpdate(DefaultSaveEventListener.java:27)

                            at org.hibernate.event.def.DefaultSaveOrUpdateEventListener.onSaveOrUpdate(DefaultSaveOrUpdateEventListener.java:70)

                            at org.hibernate.impl.SessionImpl.fireSave(SessionImpl.java:535)

                            at org.hibernate.impl.SessionImpl.save(SessionImpl.java:523)

                            at org.hibernate.impl.SessionImpl.save(SessionImpl.java:519)

                            at org.jbpm.logging.db.DbLoggingService.log(DbLoggingService.java:50)

                            at org.jbpm.svc.save.SaveLogsOperation.save(SaveLogsOperation.java:47)

                            at org.jbpm.svc.Services.save(Services.java:164)

                            at org.jbpm.JbpmContext.save(JbpmContext.java:427)

                            at org.mule.transport.bpm.jbpm.Jbpm.startProcess(Jbpm.java:152)

                            at org.mule.transport.bpm.ProcessMessageDispatcher.processAction(ProcessMessageDispatcher.java:164)

                            at org.mule.transport.bpm.ProcessMessageDispatcher.doDispatch(ProcessMessageDispatcher.java:69)

                            at org.mule.transport.AbstractMessageDispatcher$Worker.run(AbstractMessageDispatcher.java:262)

                            at org.mule.work.WorkerContext.run(WorkerContext.java:310)

                            at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1061)

                            at edu.emory.mathcs.backport.java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:575)

                            at java.lang.Thread.run(Unknown Source)

                       

                      **********************

                       

                      this definitly looks like a VariableInstance issues

                       

                      any ideas on how i fix this?

                       

                      ED