Results 1 to 5 of 5

Thread: help!jbpm3.1 about spring

  1. #1

    Default help!jbpm3.1 about spring

    add two method :

    public ProcessDefinition loadProcessDefinition(final long id){

    return (ProcessDefinition) execute(new JbpmCallback() {

    public Object doInJbpm(JbpmContext context) {
    return context.getGraphSession().loadProcessDefinition(id );
    }
    });
    }


    public void saveTaskInstance(final TaskInstance taskinstance){

    execute(new JbpmCallback() {

    public Object doInJbpm(JbpmContext context) {
    context.save(taskinstance);
    return null;
    }
    });
    }


    ************************************************** *******
    test case:

    public void testStartProcessInstance() {

    ProcessDefinition processDefinition = m_template.loadProcessDefinition(1);
    ProcessInstance instance = processDefinition.createProcessInstance();


    }


    *********************************************
    error
    @APPNAME@] ERROR [main] LazyInitializationException.<init>(19) | could not initialize proxy - the owning Session was closed
    org.hibernate.LazyInitializationException: could not initialize proxy - the owning Session was closed
    at org.hibernate.proxy.AbstractLazyInitializer.initia lize(AbstractLazyInitializer.java:56)
    at org.hibernate.proxy.AbstractLazyInitializer.getImp lementation(AbstractLazyInitializer.java:98)
    at org.hibernate.proxy.CGLIBLazyInitializer.intercept (CGLIBLazyInitializer.java:158)
    at org.jbpm.graph.def.ProcessDefinition$$EnhancerByCG LIB$$4c3f3edf.createProcessInstance(<generated>)
    at com.kingsoft.workflow.test.SpringTestDb.testStartP rocessInstance(SpringTestDb.java:45)
    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:324)
    at junit.framework.TestCase.runTest(TestCase.java:154 )
    at junit.framework.TestCase.runBare(TestCase.java:127 )
    at junit.framework.TestResult$1.protect(TestResult.ja va:106)
    at junit.framework.TestResult.runProtected(TestResult .java:124)
    at junit.framework.TestResult.run(TestResult.java:109 )
    at junit.framework.TestCase.run(TestCase.java:118)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.runTests(RemoteTestRunner.java:478)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.run(RemoteTestRunner.java:344)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRu nner.main(RemoteTestRunner.java:196)

  2. #2
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    You have lazy loading exceptions - a very common problem. See the jbpm module from Spring modules (from your stacktrace I see that you are not using it). It combines the hibernate support in Spring with Spring - see the test cases for more information.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

  3. #3

    Default reply

    thank you for you reply! i have seen your jbpm module ! i only add two mothod in JbpmTemplate.java!
    i want to test start process! i think other people will make same error!
    if you make complete test example ,i real thank you!
    1: start process
    2:find task
    3: finish task
    thank you!

  4. #4

    Default

    can you point out my error place!

  5. #5
    Join Date
    Jan 2005
    Location
    Bucharest, Romania
    Posts
    5,403

    Default

    The Hibernate connection is not closed - see the AbstractTransactional tests from the mock package inside Spring. They are used also inside jBPM tests to create transactions and keep Hibernate sessions opened during tests.
    Costin Leau
    SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
    http://twitter.com/costinl
    Please use [ c o d e ] [ / c o d e ] tags

Posting Permissions

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