1 Reply Latest reply on Jan 18, 2007 7:53 AM by bertrand.njiipwo

    RelationContext.findProcessDefinition  after CurrentJbpmCont

      Hello community,

      I'm facing the following problem: First l'll like to retrieve the current Process instance ID under execution from the current jbpmContext (getCurrentJbpmContext()) before the process call the web service. Looking in the data base hier may not give the expected results.

      I can retrieve the Process instance ID before it's persisted in the DB(what i'm looking for); this information is only in the CurrentJbpmContext, by calling findProcessDefinition(jbpmContext).

      But after the call is performed the process information are well persisted in the data base but the generated response of the remote web service can't be send back to the calling client; Some where the token makes problem. See the error logs



      2007-01-17 23:53:56,961 DEBUG [org.hibernate.loader.Loader] done entity load
      2007-01-17 23:53:56,971 DEBUG [org.jbpm.bpel.def.Scope$FaultActionHandler] handling fault: token=Token(/normalFlow)
      org.jbpm.bpel.exe.BpelFaultException: FaultValue(name={http://schemas.xmlsoap.org/ws/2004/03/business-process/}missingRequest)
      at org.jbpm.bpel.relation.jms.RelationContext.removeOutstandingRequest(RelationContext.java:185)
      at org.jbpm.bpel.relation.jms.JmsRelationService.reply(JmsRelationService.java:108)
      at org.jbpm.bpel.def.Reply.execute(Reply.java:28)
      at org.jbpm.bpel.def.Activity.enter(Activity.java:83)
      at org.jbpm.graph.def.Transition.take(Transition.java:119)
      at org.jbpm.graph.def.Node.leave(Node.java:382)
      at org.jbpm.bpel.def.Activity.leave(Activity.java:148)
      at org.jbpm.bpel.def.Assign.execute(Assign.java:41)
      at org.jbpm.bpel.def.Activity.enter(Activity.java:83)
      at org.jbpm.graph.def.Transition.take(Transition.java:119)
      at org.jbpm.graph.def.Node.leave(Node.java:382)
      at org.jbpm.bpel.def.Activity.leave(Activity.java:148)
      at org.jbpm.bpel.def.Invoke.execute(Invoke.java:29)
      at org.jbpm.bpel.def.Activity.enter(Activity.java:83)
      at org.jbpm.graph.def.Transition.take(Transition.java:119)
      at org.jbpm.graph.def.Node.leave(Node.java:382)
      at org.jbpm.bpel.def.Activity.leave(Activity.java:148)
      at org.jbpm.bpel.def.Assign.execute(Assign.java:41)
      at org.jbpm.bpel.def.Activity.enter(Activity.java:83)
      at org.jbpm.graph.def.Transition.take(Transition.java:119)
      at org.jbpm.graph.def.Node.leave(Node.java:382)
      at org.jbpm.bpel.def.Activity.leave(Activity.java:148)
      at org.jbpm.bpel.def.ProcessInstanceStarter.visit(ProcessInstanceStarter.java:45)
      at org.jbpm.bpel.def.Receive.accept(Receive.java:64)
      at org.jbpm.bpel.def.Receive$$FastClassByCGLIB$$516412f0.invoke(<generated>)
      at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
      at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.intercept(CGLIBLazyInitializer.java:163)
      at org.jbpm.bpel.def.Receive$$EnhancerByCGLIB$$8b85477d.accept(<generated>)
      at org.jbpm.bpel.def.ProcessInstanceStarter.visit(ProcessInstanceStarter.java:84)
      at org.jbpm.bpel.def.Sequence.accept(Sequence.java:84)
      at org.jbpm.bpel.def.ProcessInstanceStarter.visit(ProcessInstanceStarter.java:29)
      at org.jbpm.bpel.def.BpelDefinition.messageReceived(BpelDefinition.java:110)
      at org.jbpm.bpel.relation.jms.StartListener.onMessage(StartListener.java:95)
      at org.jboss.mq.SpyMessageConsumer.run(SpyMessageConsumer.java:694)
      at java.lang.Thread.run(Thread.java:595)
      2007-01-17 23:53:57,001 DEBUG [org.hibernate.loader.Loader] loading collection: [org.jbpm.bpel.def.Scope.faultHandlers#520]
      .
      ..
      ...
      ....
      ......

      2007-01-17 23:53:59,389 DEBUG [org.hibernate.jdbc.AbstractBatcher] about to close PreparedStatement (open PreparedStatements: 1, globally: 1)
      2007-01-17 23:53:59,440 DEBUG [org.hibernate.transaction.JDBCTransaction] re-enabling autocommit
      2007-01-17 23:53:59,440 DEBUG [org.hibernate.transaction.JDBCTransaction] committed JDBC Connection
      2007-01-17 23:53:59,440 DEBUG [org.hibernate.jdbc.ConnectionManager] aggressively releasing JDBC connection
      2007-01-17 23:53:59,440 DEBUG [org.hibernate.jdbc.ConnectionManager] releasing JDBC connection [ (open PreparedStatements: 0, globally: 0) (open ResultSets: 0, globally: 0)]
      2007-01-17 23:53:59,440 DEBUG [org.hibernate.cache.NonstrictReadWriteCache] Invalidating (again): org.jbpm.bpel.exe.ScopeInstance#103
      2007-01-17 23:53:59,440 DEBUG [net.sf.ehcache.store.MemoryStore] org.jbpm.bpel.exe.ScopeInstanceCache: Cannot remove entry as key org.jbpm.bpel.exe.ScopeInstance#103 was not found
      2007-01-17 23:53:59,440 DEBUG [org.jbpm.persistence.db.DbPersistenceService] closing hibernate session
      2007-01-17 23:53:59,440 DEBUG [org.jbpm.svc.Services] closing service 'relation': org.jbpm.bpel.relation.jms.JmsRelationService@15c4ee6
      2007-01-17 23:53:59,440 DEBUG [org.jbpm.svc.Services] closing service 'logging': org.jbpm.logging.db.DbLoggingService@13fe4e4
      2007-01-17 23:53:59,530 DEBUG [org.jbpm.configuration.JbpmContextInfo] creating jbpm context with service factories '[relation, logging, persistence]'
      2007-01-17 23:53:59,530 DEBUG [org.jbpm.JbpmContext] creating JbpmContext
      2007-01-17 23:53:59,530 DEBUG [org.jbpm.JbpmContext] closing JbpmContext
      2007-01-17 23:54:11,542 DEBUG [org.jboss.invocation.pooled.server.ServerThread] beginning dorun
      2007-01-17 23:54:28,411 DEBUG [org.jbpm.bpel.service.provider.PortProvider] response timeout expired: JMS_TQ1
      2007-01-17 23:54:28,411 INFO [STDOUT] PortProvider: Throwing JMSResponse TimeOut Expired
      2007-01-17 23:54:28,421 DEBUG [javax.xml.rpc.soap.SOAPFaultException] new SOAPFaultException [code={http://schemas.xmlsoap.org/soap/envelope/}Server,string=The service is not in an appropiate state for the requested operation,actor=null,detail=null]
      2007-01-17 23:54:28,431 DEBUG [org.jbpm.bpel.service.provider.PortProvider] request caused a fault
      javax.xml.rpc.soap.SOAPFaultException: The service is not in an appropiate state for the requested operation
      at org.jbpm.bpel.service.provider.PortProvider.receiveResponse(PortProvider.java:470)
      at org.jbpm.bpel.service.provider.PortProvider.handleRequest(PortProvider.java:213)
      at org.jboss.ws.jaxrpc.handler.HandlerWrapper.handleRequest(HandlerWrapper.java:121)
      at org.jboss.ws.jaxrpc.handler.HandlerChainBaseImpl.handleRequestInternal(HandlerChainBaseImpl.java:275)
      at org.jboss.ws.jaxrpc.handler.HandlerChainBaseImpl.handleRequest(HandlerChainBaseImpl.java:235)
      at org.jboss.ws.jaxrpc.handler.ServerHandlerChain.handleRequest(ServerHandlerChain.java:53)
      at org.jboss.ws.jaxrpc.handler.HandlerDelegateJAXRPC.callRequestHandlerChain(HandlerDelegateJAXRPC.java:96)
      at org.jboss.ws.server.AbstractServiceEndpointInvoker.callRequestHandlerChain(AbstractServiceEndpointInvoker.java:91)
      at org.jboss.ws.server.AbstractServiceEndpointInvoker.invoke(AbstractServiceEndpointInvoker.java:142)
      at org.jboss.ws.server.ServiceEndpoint.handleRequest(ServiceEndpoint.java:195)
      at org.jboss.ws.server.ServiceEndpointManager.processSOAPRequest(ServiceEndpointManager.java:373)
      at org.jboss.ws.server.StandardEndpointServlet.doPost(StandardEndpointServlet.java:116)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
      at org.jboss.ws.server.StandardEndpointServlet.service(StandardEndpointServlet.java:77)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)
      2007-01-17 23:54:28,431 DEBUG [org.jbpm.JbpmContext] closing JbpmContext
      2007-01-17 23:54:28,431 DEBUG [org.jbpm.svc.Services] closing service 'persistence': org.jbpm.persistence.db.DbPersistenceService@1dfacc4
      2007-01-17 23:54:28,431 DEBUG [org.jbpm.persistence.db.DbPersistenceService] committing hibernate transaction
      2007-01-17 23:54:28,431 DEBUG [org.hibernate.transaction.JDBCTransaction] commit


      i'll like to know if calling the methode RelationContext.findProcessDefinition() in PortConsumer.java after JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext(); is correct.

      Is there any problem with hibernate or the jbpm-persistance when i call getCurrentJbpmContext(); in my methode and then RelationContext.findProcessDefinition(jbpmContext) call also the getCurrentJbpmContext() methode (consecutive calls of getCurrentJbpmContext()) after performing some data base lookup with graphSession.jbpmContext ?

      For illustration i have
      public void myMethode(){
      JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
       try{
       if (jbpmContext != null) {
       RelationContext relationContext = getRelationContext();
      /* I have a reference on the RelationContext-object in PortConsumer. That why getReleationContex: Is this OK ?*/
       BpelDefinition bpelProcessdefinition = relationContext.findProcessDefinition(jbpmContext);
       }
      }catch (execption e){e.printStackTrace();}
      


      Is it possible that after calling relationContext.findProcessDefinition(jbpmContext); the current execution context has changed?


      I'll appreciate any suggestion about what is wrong in my concept.


      Best regards


      Bertrand

        • 1. Re: RelationContext.findProcessDefinition  after CurrentJbpm

          Hello Together,

          i found out the cause of this. It was not a good idea to use the currentJpbmContext to make a data base lookup. Instead of:

          JbpmContext jbpmContext = JbpmContext.getCurrentJbpmContext();
          is better

          JbpmConfiguration jbpmConfiguration = JbpmConfiguration.getInstance();
          JbpmContext jbpmContext = jbpmConfiguration.createJbpmContext(); //

          This will change the jpbmContext object and have some issue when resuming the process execution later.

          So before loocking up the data base first get a new jbpmContext object, performe any operation on the DB and close it by leaving the methode.


          Hope it could help others encoutering the same problem.


          Bertrand