6 Replies Latest reply on Aug 5, 2006 6:41 AM by kukeltje

    using jbpm in EJB bean for testing. please help

      Hi,
      I am new to JBPM.

      what is the error messsage mean? "object references an unsaved transient instance".

      I have the following code:

      public void ejbCreate() throws CreateException {
       log.debug("ejbCreate() is called");
       JbpmConfiguration config = null;
       try {
       InitialContext ic = new InitialContext();
       config = (JbpmConfiguration) ic
       .lookup("java:/jbpm/JbpmConfiguration");
       JbpmContext context = config.createJbpmContext();
       log.debug("config="+config);
      
       ProcessDefinition processDefinition = ProcessDefinition.parseXmlString(
       "<process-definition>" +
       " <start-state>" +
       " <transition to='s' />" +
       " </start-state>" +
       " <state name='s'>" +
       " <transition to='end' />" +
       " </state>" +
       " <end-state name='end' />" +
       "</process-definition>"
       );
      
       // The next line creates one execution of the process definition.
       // After construction, the process execution has one main path
       // of execution (=the root token) that is positioned in the
       // start-state.
       ProcessInstance processInstance =
       new ProcessInstance(processDefinition);
       Token token = processInstance.getRootToken();
      
       // Also after construction, the main path of execution is positioned
       // in the start-state of the process definition.
       log.debug(""+processDefinition.getStartState().equals(token.getNode()));
      
       token.signal();
       log.debug(""+processDefinition.getNode("s").equals(token.getNode()));
       token.signal();
       log.debug(""+processDefinition.getNode("end").equals(token.getNode()));
       } catch (NamingException ne) {
       log
       .error(
       "JbpmConfiguration was not found using JNDI. Is the SAR setup and deployed?",
       ne);
       throw new CreateException(
       "Cannot find JbpmConfiguration. Make sure jbpm.sar is configured correctly.");
       // config = JbpmConfiguration.parseResource(SERVICE_CONFIG);
       // try {
       // InitialContext ic = new InitialContext();
       // ic.bind(SERVICE_JNDI, config);
       // } catch (NamingException ne2) {
       // log.error("Unable to bind JbpmConfiguration for services", ne2);
       // throw new CreateException(
       // "Could not bind JbpmConfiguration for services");
       // }
       }
       }
      


      In addition, i have a servlet to create the instance of this session bean.
      But the following error happened:


      16:14:13,981 DEBUG [JbpmServiceManagerBean] true
      16:14:13,982 DEBUG [GraphElement] event 'before-signal' on 'State(s)' for 'Token(/)'
      16:14:13,982 DEBUG [GraphElement] event 'node-leave' on 'State(s)' for 'Token(/)'
      16:14:13,983 DEBUG [GraphElement] event 'transition' on 'Transition(8ab10c)' for 'Token(/)'
      16:14:13,983 DEBUG [GraphElement] event 'node-enter' on 'EndState(end)' for 'Token(/)'
      16:14:13,984 DEBUG [GraphElement] event 'process-end' on 'ProcessDefinition(6da7d4)' for 'Token(/)'
      16:14:13,985 DEBUG [DbPersistenceServiceFactory] creating persistence service
      16:14:13,985 DEBUG [DbPersistenceService] creating hibernate session
      16:14:13,986 DEBUG [DbPersistenceService] beginning hibernate transaction
      16:14:13,996 ERROR [SchedulerSession] org.hibernate.TransientObjectException: object references an unsaved transient instance - save the transient instance before flushing: org.jbpm.graph.exe.ProcessInstance
      16:14:13,998 ERROR [LogInterceptor] EJBException in method: public abstract com.ternary.wirelessthermometer.JbpmServiceManagerLocal com.ternary.wirelessthermometer.JbpmServiceManagerLocalHome.create() throws javax.ejb.CreateException, causedBy:
      javax.ejb.EJBException: null; CausedByException is:



      Please help!

      yang
      Why tr

        • 1. Re: using jbpm in EJB bean for testing. please help
          kukeltje

          STFF, Use google, look at the hibernate forums etc... then use that info to analyze your code. After that, if you have not found the solution, get back with all the info about what you did AND about your environment

          • 2. Re: using jbpm in EJB bean for testing. please help

            "object references an unsaved transient instance" problem solved.


            Another question:

            (1)Is it possible to call EJBs within ActionHandler?
            (2)Is it possible to call EJBs within AssignmentHandler?
            (3)Any examples available?

            All the discussion in this posts are under JBOSS-APP server 4.0.3SP1.

            Best Regards
            Yang

            • 3. Re: using jbpm in EJB bean for testing. please help

              What is the recommended way to generate monthly report?

              If using jbpm engine to drive the sales order etc...., what is the recommended way to collect the monthly report needed data?

              Because external modules are needed to generated monthly report, these modules need to collect data from database. Is it a recommended way to collect data from jbpm log entries? OR using external database to store these project specific data for reporting purpose?

              Regards
              Yang

              • 4. Re: using jbpm in EJB bean for testing. please help

                From the jbpm user guide (security chapter)


                Authentication is the process of knowing on who's behalf the code is running. In case of jBPM this information should be made available from the environment to jBPM. Cause jBPM is always executed in a specific environment like a webapp, an EJB, a swing application or some other environment, it is always the surrounding environment that should perform authentication.


                If this is the truth, why the jbpm has included fillowing tables?

                jbpm_id_group jbpm_id_membership jbpm_id_permissions jbpm_id_user


                Best Regards
                Yang



                • 5. Re: using jbpm in EJB bean for testing. please help

                  From the

                  JBoss jBPM 3.1 Data Model Wiki
                  ,

                  it seems that jbpm identity components has no direct relationship with jbpm engine.

                  Is this true?

                  I expect this is true because then i can use EJB/servlet/portlet enviroment to do SIMPLE security management.

                  Thanks
                  yang

                  • 6. Re: using jbpm in EJB bean for testing. please help
                    kukeltje

                    please post NEW questions in NEW topics. Glad to help out there