Results 1 to 9 of 9

Thread: jbpm integration problem - about context instance

  1. #1
    Join Date
    Jan 2007
    Posts
    7

    Default jbpm integration problem - about context instance

    I can deploy new process successfuly, but when I want to store variables in ContextInstance, it failed.

    code snippet:
    this.jbpmTemplate.execute(new JbpmCallback(){

    /**
    * {@inheritDoc}
    */
    public Object doInJbpm(JbpmContext context)
    throws JbpmException {
    GraphSession gs = context.getGraphSession();
    ProcessDefinition pd = gs.findLatestProcessDefinition("dbtest");
    ProcessInstance pi = pd.createProcessInstance();
    ContextInstance ci = pi.getContextInstance();
    ci.setVariable("name", "jnesta");
    context.save(pi);
    return null;
    }

    });

    if I remove the line code of "ci.setVariable("name", "jnesta");", it's ok.

    the error messages:

    Hibernate: select processdef0_.ID_ as ID1_1_, processdef0_.NAME_ as NAME2_1_, processdef0_.VERSION_ as VERSION3_1_, processdef0_.ISTERMINATIONIMPLICIT_ as ISTERMIN4_1_, processdef0_.STARTSTATE_ as STARTSTATE5_1_ from JBPM_PROCESSDEFINITION processdef0_ where processdef0_.NAME_=? order by processdef0_.VERSION_ desc limit ?
    Hibernate: insert into JBPM_TOKEN (VERSION_, NAME_, START_, END_, NODEENTER_, NEXTLOGINDEX_, ISABLETOREACTIVATEPARENT_, ISTERMINATIONIMPLICIT_, ISSUSPENDED_, NODE_, PROCESSINSTANCE_, PARENT_, SUBPROCESSINSTANCE_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
    Hibernate: insert into JBPM_PROCESSINSTANCE (VERSION_, START_, END_, ISSUSPENDED_, PROCESSDEFINITION_, ROOTTOKEN_, SUPERPROCESSTOKEN_) values (?, ?, ?, ?, ?, ?, ?)
    Hibernate: select definition0_.PROCESSDEFINITION_ as PROCESSD4_1_, definition0_.ID_ as ID1_1_, definition0_.NAME_ as NAME3_1_, definition0_.ID_ as ID1_13_0_, definition0_.NAME_ as NAME3_13_0_, definition0_.PROCESSDEFINITION_ as PROCESSD4_13_0_, definition0_.STARTTASK_ as STARTTASK5_13_0_, definition0_.CLASS_ as CLASS2_13_0_ from JBPM_MODULEDEFINITION definition0_ where definition0_.PROCESSDEFINITION_=?
    Hibernate: select events0_.PROCESSDEFINITION_ as PROCESSD5_1_, events0_.ID_ as ID1_1_, events0_.EVENTTYPE_ as EVENTTYPE2_1_, events0_.ID_ as ID1_4_0_, events0_.EVENTTYPE_ as EVENTTYPE2_4_0_, events0_.TYPE_ as TYPE3_4_0_, events0_.GRAPHELEMENT_ as GRAPHELE4_4_0_ from JBPM_EVENT events0_ where events0_.PROCESSDEFINITION_=?
    Hibernate: insert into JBPM_LOG (INDEX_, DATE_, TOKEN_, PARENT_, CLASS_) values (?, ?, ?, ?, 'I')
    Hibernate: insert into JBPM_VARIABLEINSTANCE (NAME_, CONVERTER_, TOKEN_, TOKENVARIABLEMAP_, PROCESSINSTANCE_, STRINGVALUE_, CLASS_) values (?, ?, ?, ?, ?, ?, 'S')
    Hibernate: insert into JBPM_LOG (INDEX_, DATE_, TOKEN_, PARENT_, VARIABLEINSTANCE_, CLASS_) values (?, ?, ?, ?, ?, 'R')
    Hibernate: insert into JBPM_LOG (INDEX_, DATE_, TOKEN_, PARENT_, VARIABLEINSTANCE_, OLDSTRINGVALUE_, NEWSTRINGVALUE_, CLASS_) values (?, ?, ?, ?, ?, ?, ?, 'U')
    org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
    at org.jbpm.persistence.db.DbPersistenceService.close (DbPersistenceService.java:172)
    at org.jbpm.svc.Services.close(Services.java:211)
    at org.jbpm.JbpmContext.close(JbpmContext.java:139)
    at net.nesta.jbpm.impl.WorkflowServiceImpl.startWorkf low(WorkflowServiceImpl.java:72)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:281)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:187)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :154)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:107)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :176)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:210)
    at $Proxy6.startWorkflow(Unknown Source)
    at test.DoTest.testStart(DoTest.java:21)
    at test.DoTest.main(DoTest.java:15)
    Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.context.exe.TokenVariableMap
    at org.hibernate.engine.ForeignKeys.getEntityIdentifi erIfNotUnsaved(ForeignKeys.java:216)
    at org.hibernate.type.EntityType.getIdentifier(Entity Type.java:108)
    at org.hibernate.type.ManyToOneType.isDirty(ManyToOne Type.java:221)
    at org.hibernate.type.TypeFactory.findDirty(TypeFacto ry.java:476)
    at org.hibernate.persister.entity.AbstractEntityPersi ster.findDirty(AbstractEntityPersister.java:2803)
    at org.hibernate.event.def.DefaultFlushEntityEventLis tener.dirtyCheck(DefaultFlushEntityEventListener.j ava:467)
    at org.hibernate.event.def.DefaultFlushEntityEventLis tener.isUpdateNecessary(DefaultFlushEntityEventLis tener.java:190)
    at org.hibernate.event.def.DefaultFlushEntityEventLis tener.onFlushEntity(DefaultFlushEntityEventListene r.java:113)
    at org.hibernate.event.def.AbstractFlushingEventListe ner.flushEntities(AbstractFlushingEventListener.ja va:195)
    at org.hibernate.event.def.AbstractFlushingEventListe ner.flushEverythingToExecutions(AbstractFlushingEv entListener.java:76)
    at org.hibernate.event.def.DefaultFlushEventListener. onFlush(DefaultFlushEventListener.java:26)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.j ava:980)
    at org.hibernate.impl.SessionImpl.managedFlush(Sessio nImpl.java:353)
    at org.hibernate.transaction.JDBCTransaction.commit(J DBCTransaction.java:106)
    at org.jbpm.persistence.db.DbPersistenceService.close (DbPersistenceService.java:162)
    ... 16 more
    Exception in thread "main" org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.persistence.JbpmPersistenceE xception: couldn't commit hibernate session}
    at org.jbpm.svc.Services.close(Services.java:223)
    at org.jbpm.JbpmContext.close(JbpmContext.java:139)
    at net.nesta.jbpm.impl.WorkflowServiceImpl.startWorkf low(WorkflowServiceImpl.java:72)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Nativ e Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Native MethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(De legatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:585)
    at org.springframework.aop.support.AopUtils.invokeJoi npointUsingReflection(AopUtils.java:281)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.invokeJoinpoint(ReflectiveMethodInvocat ion.java:187)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :154)
    at org.springframework.transaction.interceptor.Transa ctionInterceptor.invoke(TransactionInterceptor.jav a:107)
    at org.springframework.aop.framework.ReflectiveMethod Invocation.proceed(ReflectiveMethodInvocation.java :176)
    at org.springframework.aop.framework.JdkDynamicAopPro xy.invoke(JdkDynamicAopProxy.java:210)
    at $Proxy6.startWorkflow(Unknown Source)
    at test.DoTest.testStart(DoTest.java:21)
    at test.DoTest.main(DoTest.java:15)
    Caused by: org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
    at org.jbpm.persistence.db.DbPersistenceService.close (DbPersistenceService.java:172)
    at org.jbpm.svc.Services.close(Services.java:211)
    ... 15 more
    Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.context.exe.TokenVariableMap
    at org.hibernate.engine.ForeignKeys.getEntityIdentifi erIfNotUnsaved(ForeignKeys.java:216)
    at org.hibernate.type.EntityType.getIdentifier(Entity Type.java:108)
    at org.hibernate.type.ManyToOneType.isDirty(ManyToOne Type.java:221)
    at org.hibernate.type.TypeFactory.findDirty(TypeFacto ry.java:476)
    at org.hibernate.persister.entity.AbstractEntityPersi ster.findDirty(AbstractEntityPersister.java:2803)
    at org.hibernate.event.def.DefaultFlushEntityEventLis tener.dirtyCheck(DefaultFlushEntityEventListener.j ava:467)
    at org.hibernate.event.def.DefaultFlushEntityEventLis tener.isUpdateNecessary(DefaultFlushEntityEventLis tener.java:190)
    at org.hibernate.event.def.DefaultFlushEntityEventLis tener.onFlushEntity(DefaultFlushEntityEventListene r.java:113)
    at org.hibernate.event.def.AbstractFlushingEventListe ner.flushEntities(AbstractFlushingEventListener.ja va:195)
    at org.hibernate.event.def.AbstractFlushingEventListe ner.flushEverythingToExecutions(AbstractFlushingEv entListener.java:76)
    at org.hibernate.event.def.DefaultFlushEventListener. onFlush(DefaultFlushEventListener.java:26)
    at org.hibernate.impl.SessionImpl.flush(SessionImpl.j ava:980)
    at org.hibernate.impl.SessionImpl.managedFlush(Sessio nImpl.java:353)
    at org.hibernate.transaction.JDBCTransaction.commit(J DBCTransaction.java:106)
    at org.jbpm.persistence.db.DbPersistenceService.close (DbPersistenceService.java:162)
    ... 16 more

  2. #2
    Join Date
    Jan 2007
    Posts
    7

    Default configuration files

    configuration:

    1. hibernate.cfg.xml
    <?xml version='1.0' encoding='utf-8'?>

    <!DOCTYPE hibernate-configuration PUBLIC
    "-//Hibernate/Hibernate Configuration DTD 3.0//EN"
    "http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">

    <hibernate-configuration>
    <session-factory>

    <mapping resource="net/nesta/test/model/TestBean.hbm.xml"></mapping>
    <!-- ############################################ -->
    <!-- # mapping files with external dependencies # -->
    <!-- ############################################ -->

    <!-- following mapping file has a dependendy on -->
    <!-- 'bsh-{version}.jar'. -->
    <!-- uncomment this if you don't have bsh on your -->
    <!-- classpath. you won't be able to use the -->
    <!-- script element in process definition files -->
    <mapping resource="org/jbpm/graph/action/Script.hbm.xml"/>

    <!-- following mapping files have a dependendy on -->
    <!-- 'jbpm-identity-{version}.jar', mapping files -->
    <!-- of the pluggable jbpm identity component. -->
    <!-- comment out the following 3 lines if you don't-->
    <!-- want to use the default jBPM identity mgmgt -->
    <!-- component -->
    <!--
    <mapping resource="org/jbpm/identity/User.hbm.xml"/>
    <mapping resource="org/jbpm/identity/Group.hbm.xml"/>
    <mapping resource="org/jbpm/identity/Membership.hbm.xml"/>
    -->
    <!-- ###################### -->
    <!-- # jbpm mapping files # -->
    <!-- ###################### -->

    <!-- hql queries and type defs -->
    <mapping resource="org/jbpm/db/hibernate.queries.hbm.xml" />

    <!-- graph.def mapping files -->
    <mapping resource="org/jbpm/graph/def/ProcessDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Node.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Transition.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Event.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/Action.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/SuperState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/def/ExceptionHandler.hbm.xml"/>
    <mapping resource="org/jbpm/instantiation/Delegation.hbm.xml"/>

    <!-- graph.node mapping files -->
    <mapping resource="org/jbpm/graph/node/StartState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/EndState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/ProcessState.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/Decision.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/Fork.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/Join.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/State.hbm.xml"/>
    <mapping resource="org/jbpm/graph/node/TaskNode.hbm.xml"/>

    <!-- context.def mapping files -->
    <mapping resource="org/jbpm/context/def/ContextDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/context/def/VariableAccess.hbm.xml"/>

    <!-- taskmgmt.def mapping files -->
    <mapping resource="org/jbpm/taskmgmt/def/TaskMgmtDefinition.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/Swimlane.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/Task.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/def/TaskController.hbm.xml"/>

    <!-- module.def mapping files -->
    <mapping resource="org/jbpm/module/def/ModuleDefinition.hbm.xml"/>

    <!-- bytes mapping files -->
    <mapping resource="org/jbpm/bytes/ByteArray.hbm.xml"/>

    <!-- file.def mapping files -->
    <mapping resource="org/jbpm/file/def/FileDefinition.hbm.xml"/>

    <!-- scheduler.def mapping files -->
    <mapping resource="org/jbpm/scheduler/def/CreateTimerAction.hbm.xml"/>
    <mapping resource="org/jbpm/scheduler/def/CancelTimerAction.hbm.xml"/>

    <!-- graph.exe mapping files -->
    <mapping resource="org/jbpm/graph/exe/Comment.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/ProcessInstance.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/Token.hbm.xml"/>
    <mapping resource="org/jbpm/graph/exe/RuntimeAction.hbm.xml"/>

    <!-- module.exe mapping files -->
    <mapping resource="org/jbpm/module/exe/ModuleInstance.hbm.xml"/>

    <!-- context.exe mapping files -->
    <mapping resource="org/jbpm/context/exe/ContextInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/TokenVariableMap.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/VariableInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/ByteArrayInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/DateInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/DoubleInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/HibernateLongInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/HibernateStringInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/LongInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/NullInstance.hbm.xml"/>
    <mapping resource="org/jbpm/context/exe/variableinstance/StringInstance.hbm.xml"/>

    <!-- msg.db mapping files -->
    <mapping resource="org/jbpm/msg/Message.hbm.xml"/>
    <mapping resource="org/jbpm/msg/db/TextMessage.hbm.xml"/>
    <mapping resource="org/jbpm/command/ExecuteActionCommand.hbm.xml"/>
    <mapping resource="org/jbpm/command/ExecuteNodeCommand.hbm.xml"/>
    <mapping resource="org/jbpm/command/SignalCommand.hbm.xml"/>
    <mapping resource="org/jbpm/command/TaskInstanceEndCommand.hbm.xml"/>

    <!-- taskmgmt.exe mapping files -->
    <mapping resource="org/jbpm/taskmgmt/exe/TaskMgmtInstance.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/TaskInstance.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/PooledActor.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/exe/SwimlaneInstance.hbm.xml"/>

    <!-- scheduler.exe mapping files -->
    <mapping resource="org/jbpm/scheduler/exe/Timer.hbm.xml"/>

    <!-- logging mapping files -->
    <mapping resource="org/jbpm/logging/log/ProcessLog.hbm.xml"/>
    <mapping resource="org/jbpm/logging/log/MessageLog.hbm.xml"/>
    <mapping resource="org/jbpm/logging/log/CompositeLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ActionLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/NodeLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ProcessInstanceCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ProcessInstanceEndLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/ProcessStateLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/SignalLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/TokenCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/TokenEndLog.hbm.xml"/>
    <mapping resource="org/jbpm/graph/log/TransitionLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableDeleteLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/VariableUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/ByteArrayUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/DateUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/DoubleUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/HibernateLongUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/HibernateStringUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/LongUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/context/log/variableinstance/StringUpdateLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskAssignLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/TaskEndLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneCreateLog.hbm.xml"/>
    <mapping resource="org/jbpm/taskmgmt/log/SwimlaneAssignLog.hbm.xml"/>

    </session-factory>
    </hibernate-configuration>

  3. #3
    Join Date
    Jan 2007
    Posts
    7

    Default

    2. jbpm.cfg.xml
    <jbpm-configuration>

    <!--
    The default configurations can be found in org/jbpm/default.jbpm.cfg.xml
    Those configurations can be overwritten by putting this file called
    jbpm.cfg.xml on the root of the classpath and put in the customized values.
    -->
    <jbpm-context>
    <service name="persistence" factory="org.jbpm.persistence.db.DbPersistenceServ iceFactory" />
    <service name="logging" factory="org.jbpm.logging.db.DbLoggingServiceFacto ry" />
    </jbpm-context>

    <!-- configuration resource files pointing to default configuration files in jbpm-{version}.jar -->
    <string name="resource.business.calendar" value="org/jbpm/calendar/jbpm.business.calendar.properties" />
    <string name="resource.default.modules" value="org/jbpm/graph/def/jbpm.default.modules.properties" />
    <string name="resource.converter" value="org/jbpm/db/hibernate/jbpm.converter.properties" />
    <string name="resource.action.types" value="org/jbpm/graph/action/action.types.xml" />
    <string name="resource.node.types" value="org/jbpm/graph/node/node.types.xml" />
    <string name="resource.parsers" value="org/jbpm/jpdl/par/jbpm.parsers.xml" />
    <string name="resource.varmapping" value="org/jbpm/context/exe/jbpm.varmapping.xml" />

    <long name="jbpm.msg.wait.timout" value="5000" singleton="true" />
    <int name="jbpm.byte.block.size" value="1024" singleton="true" />
    <string name="mail.smtp.host" value="localhost" />
    <bean name="jbpm.task.instance.factory" class="org.jbpm.taskmgmt.impl.DefaultTaskInstanceF actoryImpl" singleton="true" />
    <bean name="jbpm.variable.resolver" class="org.jbpm.jpdl.el.impl.JbpmVariableResolver" singleton="true" />
    <bean name="jbpm.mail.address.resolver" class="org.jbpm.identity.mail.IdentityAddressResol ver" singleton="true" />

    </jbpm-configuration>

    3. spring-jbpm.xml
    <?xml version="1.0"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schem...ring-beans.xsd
    http://www.springframework.org/schema/tx
    http://www.springframework.org/schema/tx/spring-tx.xsd">

    <bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
    <property name="driverClass">
    <value>com.mysql.jdbc.Driver</value>
    </property>
    <property name="jdbcUrl">
    <value>jdbc:mysql://localhost:3306/jbpm</value>
    </property>
    <property name="properties">
    <props>
    <prop key="c3p0.minPoolSize">2</prop>
    <prop key="c3p0.maxPoolSize">5</prop>
    <prop key="c3p0.idle_test_period">1000</prop>
    <prop key="user">root</prop>
    <prop key="password"></prop>
    </props>
    </property>
    </bean>

    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSes sionFactoryBean">
    <property name="dataSource">
    <ref local="dataSource" />
    </property>
    <property name="configLocations">
    <list>
    <value>classpath:hibernate.cfg.xml</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.MySQ LDialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.hbm2ddl.auto">update</prop>
    <prop key="hibernate.cache.use_query_cache">false</prop>
    </props>
    </property>
    </bean>

    <bean id="jbpmConfiguration"
    class="org.springmodules.workflow.jbpm31.LocalJbpm ConfigurationFactoryBean">
    <property name="sessionFactory" ref="sessionFactory"/>
    <property name="configuration" value="classpath:jbpm.cfg.xml"/>
    </bean>

    <bean id="jbpmTemplate" class="org.springmodules.workflow.jbpm31.JbpmTempl ate">
    <constructor-arg ref="jbpmConfiguration"/>
    </bean>

    <tx:annotation-driven/>

    <bean id="transactionManager" class="org.springframework.orm.hibernate3.Hibernat eTransactionManager">
    <property name="sessionFactory">
    <ref local="sessionFactory"/>
    </property>
    </bean>

    <bean id="workflowService" class="net.nesta.jbpm.impl.WorkflowServiceImpl">
    <property name="jbpmTemplate" ref="jbpmTemplate"></property>
    </bean>

    <bean id="testService" class="net.nesta.test.impl.TestBeanServiceImpl">
    <property name="sessionFactory" ref="sessionFactory"></property>
    </bean>
    </beans>

  4. #4
    Join Date
    Jan 2007
    Posts
    7

    Default

    After change a process definition, it 's ok.

  5. #5
    Join Date
    Jan 2007
    Posts
    7

    Default

    It runs successfully with process:
    ProcessDefinition processDefinition = ProcessDefinition
    .parseXmlString("<process-definition name='howareyou'>"
    + " <start-state name='start'>"
    + " <transition to='s' />" + " </start-state>"
    + " <state name='s'>" + " <transition to='end' />"
    + " </state>" + " <end-state name='end' />"
    + "</process-definition>");



    But it fails with process:
    ProcessDefinition definition = new ProcessDefinition();
    definition.setName("dbtest");

    Transition open = new Transition("open");
    open.setProcessDefinition(definition);

    StartState newS = new StartState("new");
    newS.addLeavingTransition(open);

    State openS = new State("open");
    openS.addArrivingTransition(open);

    open.setFrom(newS);
    open.setTo(openS);

    EndState end = new EndState("close");

    Transition close = new Transition("close");
    close.setFrom(openS);
    close.setTo(end);
    close.setProcessDefinition(definition);
    openS.addLeavingTransition(close);
    end.addArrivingTransition(close);

    definition.setStartState(newS);
    definition.addNode(openS);
    definition.addNode(end);

    Thanks in advance.

  6. #6
    Join Date
    Sep 2004
    Posts
    602

    Default

    Quote Originally Posted by jnesta View Post
    I can deploy new process successfuly, but when I want to store variables in ContextInstance, it failed.

    Caused by: org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.context.exe.TokenVariableMap
    I don't know that much about JBPM but can tell you what the Hibernate message means.

    It's saying you are trying to save one object which contains another unsaved object (org.jbpm.context.exe.TokenVariableMap i.e. your variables).

    Normally in Hibernate you set up your mappings so it cascades through, saving unsaved object children before saving the parent (i.e. cascaded saves)). Obviously the JBPM mapping isn't doing this.

    My guess is you are saving things in the wrong order - it seems that you are trying to save the ProcessInstance without having first saved the ContextInstance - would that make sense ?

  7. #7
    Join Date
    Jan 2007
    Posts
    7

    Default

    Quote Originally Posted by Paul Newport View Post
    I don't know that much about JBPM but can tell you what the Hibernate message means.

    It's saying you are trying to save one object which contains another unsaved object (org.jbpm.context.exe.TokenVariableMap i.e. your variables).

    Normally in Hibernate you set up your mappings so it cascades through, saving unsaved object children before saving the parent (i.e. cascaded saves)). Obviously the JBPM mapping isn't doing this.

    My guess is you are saving things in the wrong order - it seems that you are trying to save the ProcessInstance without having first saved the ContextInstance - would that make sense ?
    I agree with you in hibernate message.

    Now I think that the problem in defining jbpm process with jbpm's api.

    What I missed?

    Any idea? Thanks in advance.

  8. #8
    Join Date
    Jan 2007
    Posts
    7

    Default

    Using codes as follows instead of new ProcessDefinition, it's ok.
    Code:
    ProcessDefinition definition = ProcessDefinition.createNewProcessDefinition();

  9. #9
    Join Date
    Feb 2009
    Posts
    5

    Default

    I was having a similar problem. After I added

    context.deployProcessDefinition(processDefinition) ;

    before context.save(processInstance), the problem got resolved.

    The reason for the error was trying to save the process instance, without saving the process definition first.
    Last edited by eren.aykin; Jun 8th, 2010 at 03:32 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •