7 Replies Latest reply on May 23, 2007 3:37 AM by mputz

    new instance

    ricardomarques

      Someone see anything that could be wrong?

      Process:

      
      <?xml version="1.0" encoding="UTF-8"?>
      
      <process-definition
       xmlns="urn:jbpm.org:jpdl-3.2"
       name="simple">
       <start-state name="start">
       <transition name="to_state" to="first">
       <action name="action" class="com.sample.action.MessageActionHandler">
       <message>Going to the first state!</message>
       </action>
      
      
       </transition>
       </start-state>
       <state name="first">
       <transition name="to_end" to="end">
       <action name="action" class="com.sample.action.MessageActionHandler">
       <message>About to finish!</message>
       </action>
       </transition>
       </state>
       <end-state name="end"></end-state>
      </process-definition>
      
      



      Instanciation code:

      
      JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
       JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
       try {
      
       ProcessInstance processInstance = null;
       ProcessDefinition processDefinition = jbpmContext.getGraphSession().getProcessDefinition(15);
      
       processInstance = (ProcessInstance)processDefinition.createInstance();
       processInstance.signal();
      
       jbpmContext.save(processInstance);
      
       }
       catch (Exception e) {
       e.printStackTrace();
       }
       finally {
       jbpmContext.close();
       }
      
      



      Exception:

      
      12:07:30,093 ERROR [STDERR] org.jbpm.JbpmException: token 'Token(/)' can't be signalled cause it is currently not positioned in a node
      12:07:30,093 ERROR [STDERR] at org.jbpm.graph.exe.Token.signal(Token.java:134)
      12:07:30,093 ERROR [STDERR] at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:251)
      12:07:30,093 ERROR [STDERR] at pep.workflow.console.servlets.UploadServlet.processRequest(UploadServlet.java:47)
      12:07:30,093 ERROR [STDERR] at pep.workflow.console.servlets.UploadServlet.doGet(UploadServlet.java:80)
      12:07:30,203 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
      12:07:30,203 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      12:07:30,203 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      12:07:30,203 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      12:07:30,203 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      12:07:30,203 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      12:07:30,203 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      12:07:30,203 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      12:07:30,203 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      12:07:30,203 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      12:07:30,203 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      12:07:30,203 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
      
      


      Help!

        • 1. Re: new instance
          kukeltje

          I normally do

           ProcessInstance pi = new ProcessInstance( pd );
           pi.signal();
          


          to start a process, but that should not make a difference...

          Turn on debug logging and see what happens

          • 2. Re: new instance
            ricardomarques

            Thanks for the quick reply kukeltje. I'm really getting nuts with this. Here's the log, please let me know if is enough for you.

            By the way, i've tried the code the same way than I, and the result was the same.

            
            13:37:04,750 DEBUG [DefaultSaveOrUpdateEventListener] saving transient instance
            13:37:04,750 DEBUG [AbstractSaveEventListener] saving [org.jbpm.graph.exe.ProcessInstance#<null>]
            13:37:04,750 DEBUG [AbstractSaveEventListener] executing insertions
            13:37:04,750 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: org.jbpm.graph.exe.ProcessInstance
            13:37:04,750 DEBUG [CascadingAction] cascading to saveOrUpdate: org.jbpm.graph.exe.Token
            13:37:05,250 DEBUG [VersionValue] version unsaved-value strategy UNDEFINED
            13:37:05,250 DEBUG [IdentifierValue] id unsaved-value: 0
            13:37:05,250 DEBUG [AbstractSaveEventListener] transient instance of: org.jbpm.graph.exe.Token
            13:37:05,250 DEBUG [DefaultSaveOrUpdateEventListener] saving transient instance
            13:37:05,250 DEBUG [AbstractSaveEventListener] saving [org.jbpm.graph.exe.Token#<null>]
            13:37:05,250 DEBUG [AbstractSaveEventListener] executing insertions
            13:37:05,250 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: org.jbpm.graph.exe.Token
            13:37:05,750 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: org.jbpm.graph.exe.Token
            13:37:05,750 DEBUG [Versioning] using initial version: 0
            13:37:05,781 DEBUG [AbstractSaveEventListener] executing identity-insert immediately
            13:37:05,781 DEBUG [AbstractEntityPersister] Inserting entity: org.jbpm.graph.exe.Token (native id)
            13:37:05,781 DEBUG [AbstractEntityPersister] Version: 0
            13:37:05,781 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
            13:37:06,250 DEBUG [SQL] insert into JBPM_TOKEN (VERSION_, NAME_, START_, END_, NODEENTER_, NEXTLOGINDEX_, ISABLETOREACTIVATEPARENT_, ISTERMINATIONIMPLICIT_, ISSUSPENDED_, LOCK_, NODE_, PROCESSINSTANCE_, PARENT_, SUBPROCESSINSTANCE_) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
            13:37:06,250 DEBUG [AbstractBatcher] preparing statement
            13:37:06,250 DEBUG [AbstractEntityPersister] Dehydrating entity: [org.jbpm.graph.exe.Token#<null>]
            13:37:06,250 DEBUG [IntegerType] binding '0' to parameter: 1
            13:37:06,250 DEBUG [StringType] binding null to parameter: 2
            13:37:06,250 DEBUG [TimestampType] binding '2007-05-22 13:37:04' to parameter: 3
            13:37:06,265 DEBUG [TimestampType] binding null to parameter: 4
            13:37:06,265 DEBUG [TimestampType] binding null to parameter: 5
            13:37:06,265 DEBUG [IntegerType] binding '0' to parameter: 6
            13:37:06,265 DEBUG [BooleanType] binding 'true' to parameter: 7
            13:37:06,750 DEBUG [BooleanType] binding 'false' to parameter: 8
            13:37:06,750 DEBUG [BooleanType] binding 'false' to parameter: 9
            13:37:06,750 DEBUG [StringType] binding null to parameter: 10
            13:37:06,750 DEBUG [LongType] binding null to parameter: 11
            13:37:06,750 DEBUG [LongType] binding null to parameter: 12
            13:37:06,750 DEBUG [LongType] binding null to parameter: 13
            13:37:06,750 DEBUG [LongType] binding null to parameter: 14
            13:37:06,765 DEBUG [IdentifierGeneratorFactory] Natively generated identity: 90
            13:37:07,250 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
            13:37:07,250 DEBUG [AbstractBatcher] closing statement
            13:37:07,250 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: org.jbpm.graph.exe.Token
            13:37:07,250 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: org.jbpm.graph.exe.Token
            13:37:07,250 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: org.jbpm.graph.exe.ProcessInstance
            13:37:07,250 DEBUG [Versioning] using initial version: 0
            13:37:07,250 DEBUG [AbstractSaveEventListener] executing identity-insert immediately
            13:37:07,250 DEBUG [AbstractEntityPersister] Inserting entity: org.jbpm.graph.exe.ProcessInstance (native id)
            13:37:07,750 DEBUG [AbstractEntityPersister] Version: 0
            13:37:07,750 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
            13:37:07,750 DEBUG [SQL] insert into JBPM_PROCESSINSTANCE (VERSION_, KEY_, START_, END_, ISSUSPENDED_, PROCESSDEFINITION_, ROOTTOKEN_, SUPERPROCESSTOKEN_) values (?, ?, ?, ?, ?, ?, ?, ?)
            13:37:07,750 DEBUG [AbstractBatcher] preparing statement
            13:37:07,750 DEBUG [AbstractEntityPersister] Dehydrating entity: [org.jbpm.graph.exe.ProcessInstance#<null>]
            13:37:07,750 DEBUG [IntegerType] binding '0' to parameter: 1
            13:37:08,250 DEBUG [StringType] binding null to parameter: 2
            13:37:08,250 DEBUG [TimestampType] binding '2007-05-22 13:37:04' to parameter: 3
            13:37:08,250 DEBUG [TimestampType] binding null to parameter: 4
            13:37:08,250 DEBUG [BooleanType] binding 'false' to parameter: 5
            13:37:08,250 DEBUG [LongType] binding '15' to parameter: 6
            13:37:08,250 DEBUG [LongType] binding '90' to parameter: 7
            13:37:08,250 DEBUG [LongType] binding null to parameter: 8
            13:37:08,250 DEBUG [IdentifierGeneratorFactory] Natively generated identity: 90
            13:37:08,750 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
            13:37:08,750 DEBUG [AbstractBatcher] closing statement
            13:37:08,750 DEBUG [Cascade] processing cascade ACTION_SAVE_UPDATE for: org.jbpm.graph.exe.ProcessInstance
            13:37:08,750 DEBUG [Cascade] done processing cascade ACTION_SAVE_UPDATE for: org.jbpm.graph.exe.ProcessInstance
            13:37:08,750 DEBUG [DefaultInitializeCollectionEventListener] initializing collection [org.jbpm.graph.def.ProcessDefinition.definitions#15]
            13:37:08,750 DEBUG [DefaultInitializeCollectionEventListener] checking second-level cache
            13:37:08,750 DEBUG [NonstrictReadWriteCache] Cache lookup: org.jbpm.graph.def.ProcessDefinition.definitions#15
            13:37:09,250 DEBUG [NonstrictReadWriteCache] Cache miss
            13:37:09,250 DEBUG [DefaultInitializeCollectionEventListener] collection not cached
            13:37:09,250 DEBUG [Loader] loading collection: [org.jbpm.graph.def.ProcessDefinition.definitions#15]
            13:37:09,250 DEBUG [AbstractBatcher] about to open PreparedStatement (open PreparedStatements: 0, globally: 0)
            13:37:09,250 DEBUG [SQL] select definition0_.PROCESSDEFINITION_ as PROCESSD4_1_, definition0_.ID_ as ID1_1_, definition0_.NAME_ as NAME3_1_, definition0_.ID_ as ID1_133_0_, definition0_.NAME_ as NAME3_133_0_, definition0_.PROCESSDEFINITION_ as PROCESSD4_133_0_, definition0_.STARTTASK_ as STARTTASK5_133_0_, definition0_.CLASS_ as CLASS2_133_0_ from JBPM_MODULEDEFINITION definition0_ where definition0_.PROCESSDEFINITION_=?
            13:37:09,750 DEBUG [AbstractBatcher] preparing statement
            13:37:09,750 DEBUG [LongType] binding '15' to parameter: 1
            13:37:09,765 DEBUG [AbstractBatcher] about to open ResultSet (open ResultSets: 0, globally: 0)
            13:37:09,765 DEBUG [Loader] result set contains (possibly empty) collection: [org.jbpm.graph.def.ProcessDefinition.definitions#15]
            13:37:09,765 DEBUG [CollectionLoadContext] uninitialized collection: initializing
            13:37:09,765 DEBUG [Loader] processing result set
            13:37:09,765 DEBUG [Loader] done processing result set (0 rows)
            13:37:09,765 DEBUG [AbstractBatcher] about to close ResultSet (open ResultSets: 1, globally: 1)
            13:37:10,250 DEBUG [AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
            13:37:10,250 DEBUG [AbstractBatcher] closing statement
            13:37:10,250 DEBUG [Loader] total objects hydrated: 0
            13:37:10,250 DEBUG [CollectionLoadContext] 1 collections were found in result set for role: org.jbpm.graph.def.ProcessDefinition.definitions
            13:37:10,250 DEBUG [CollectionLoadContext] Caching collection: [org.jbpm.graph.def.ProcessDefinition.definitions#15]
            13:37:10,250 DEBUG [NonstrictReadWriteCache] Caching: org.jbpm.graph.def.ProcessDefinition.definitions#15
            13:37:10,250 DEBUG [CollectionLoadContext] collection fully initialized: [org.jbpm.graph.def.ProcessDefinition.definitions#15]
            13:37:10,250 DEBUG [CollectionLoadContext] 1 collections initialized for role: org.jbpm.graph.def.ProcessDefinition.definitions
            13:37:10,750 DEBUG [StatefulPersistenceContext] initializing non-lazy collections
            13:37:10,750 DEBUG [Loader] done loading collection
            13:37:10,750 DEBUG [DefaultInitializeCollectionEventListener] collection initialized
            13:37:10,750 ERROR [STDERR] org.jbpm.JbpmException: token 'Token(/)' can't be signalled cause it is currently not positioned in a node
            13:37:10,750 ERROR [STDERR] at org.jbpm.graph.exe.Token.signal(Token.java:134)
            13:37:10,750 ERROR [STDERR] at org.jbpm.graph.exe.ProcessInstance.signal(ProcessInstance.java:251)
            13:37:10,765 ERROR [STDERR] at pep.workflow.console.servlets.UploadServlet.processRequest(UploadServlet.java:61)
            13:37:10,765 ERROR [STDERR] at pep.workflow.console.servlets.UploadServlet.doGet(UploadServlet.java:123)
            13:37:10,765 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
            13:37:10,765 ERROR [STDERR] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
            13:37:10,765 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
            13:37:10,765 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            13:37:10,765 ERROR [STDERR] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
            13:37:10,765 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
            13:37:10,765 ERROR [STDERR] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
            13:37:11,265 ERROR [STDERR] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
            13:37:11,265 ERROR [STDERR] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
            13:37:11,265 ERROR [STDERR] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
            13:37:11,265 ERROR [STDERR] at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
            13:37:11,265 ERROR [STDERR] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
            13:37:11,765 ERROR [STDERR] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
            13:37:11,765 ERROR [STDERR] at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
            13:37:11,765 ERROR [STDERR] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
            13:37:11,765 ERROR [STDERR] at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
            13:37:11,765 ERROR [STDERR] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
            13:37:11,765 ERROR [STDERR] at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
            13:37:12,265 ERROR [STDERR] at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
            13:37:12,265 ERROR [STDERR] at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
            13:37:12,265 ERROR [STDERR] at java.lang.Thread.run(Thread.java:595)
            13:37:12,265 DEBUG [JbpmContext] closing JbpmContext
            13:37:12,265 DEBUG [Services] closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@9468ca
            13:37:12,265 DEBUG [DbPersistenceService] committing hibernate transaction
            13:37:12,765 DEBUG [JDBCTransaction] commit
            13:37:12,765 DEBUG [SessionImpl] automatically flushing session
            
            


            • 3. Re: new instance
              mputz

              I just tried your code and it worked for me.

              What is strange is in your logs there is no NODE_ assigned in the insert statement for JBPM_TOKEN:

              13:37:06,750 DEBUG [LongType] binding null to parameter: 11


              I wonder if your process deployed properly? Can you check in your db if you have the nodes for this processdefinition (id=15 according to the logs):

              SELECT * FROM jbpm_node j where PROCESSDEFINITION_ = 15


              This should return three rows for the nodes 'start', 'first', 'end'.

              Regards, Martin

              • 4. Re: new instance
                ricardomarques

                Hello Martin, thanks for your feedback.

                Regarding your post, you got the rabbit! I get no rows for that query. In fact I only get rows for the first two process that I deployed, and I going on 15th.

                The code i'm using to deploy is this:

                JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
                 JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext();
                 try {
                 ProcessDefinition p = new ProcessDefinition("myprocess");
                
                 p.parseParZipInputStream(new ZipInputStream(new FileInputStream("c:\\myprocess.par")));
                
                 jbpmContext.deployProcessDefinition(p);
                
                
                 }
                 catch (Exception e) {
                 e.printStackTrace();
                 }
                 finally {
                 jbpmContext.close();
                 }
                


                • 5. Re: new instance
                  mputz

                  You shouldn't create a new ProcessDefinition object by calling

                  ProcessDefinition p = new ProcessDefinition("myprocess");

                  first.

                  Instead, create it like this:
                  ZipInputStream zipInputStream = new ZipInputStream(new FileInputStream("c:\\myprocess.par"));
                  ProcessDefinition processDefinition = ProcessDefinition.parseParZipInputStream(zipInputStream);
                  jbpmContext.deployProcessDefinition(processDefinition);
                  zipInputStream.close();


                  Regards, Martin

                  • 6. Re: new instance
                    ricardomarques

                    Weeeeee! It works now thanks man, I will make sure that you will have a place in heaven :P

                    • 7. Re: new instance
                      mputz

                      You are welcome, no problem!

                      And enjoy working with jBPM ;-)

                      Regards, Martin