1 Reply Latest reply on May 9, 2008 6:59 AM by saurabh gupta

    "org.hibernate.TransactionException: Transaction not success

    jacobo Newbie

      Hi there, i am having the exception above mentioned, I would appreciate very much if someone could help me. I have this methods:
      public class GexpRequestProcessor extends TilesRequestProcessor {
      public void process(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {

      // Wrap multipart requests with a special wrapper
      request = processMultipart(request);

      // Identify the path component we will use to select a mapping
      String path = processPath(request, response);
      if (path == null) {
      return;
      }

      if (log.isDebugEnabled()) {
      log.debug("Processing a '" + request.getMethod() +
      "' for path '" + path + "'");
      }

      // Select a Locale for the current user if requested
      processLocale(request, response);

      // Set the content type and no-caching headers if requested
      processContent(request, response);
      processNoCache(request, response);

      // General purpose preprocessing hook
      if (!processPreprocess(request, response)) {
      return;
      }

      this.processCachedMessages(request, response);

      // Identify the mapping for this request
      ActionMapping mapping = processMapping(request, response, path);
      if (mapping == null) {
      return;
      }

      // Check for any role required to perform this action
      if (!processRoles(request, response, mapping)) {
      return;
      }

      // Process any ActionForm bean related to this request
      ActionForm form = processActionForm(request, response, mapping);
      processPopulate(request, response, form, mapping);

      // Validate any fields of the ActionForm bean, if applicable
      try {
      if (!processValidate(request, response, form, mapping)) {
      return;
      }
      } catch (InvalidCancelException e) {
      ActionForward forward = processException(request, response, e, form, mapping);
      processForwardConfig(request, response, forward);
      return;
      } catch (IOException e) {
      throw e;
      } catch (ServletException e) {
      throw e;
      }
      //abrimos el contexto de jbpm.
      processOpenJbpm();

      // Process a forward or include specified by this mapping
      if (!processForward(request, response, mapping)) {
      return;
      }

      if (!processInclude(request, response, mapping)) {
      return;
      }


      // Create or acquire the Action instance to process this request
      Action action = processActionCreate(request, response, mapping);
      if (action == null) {
      return;
      }


      // Call the Action instance itself
      ActionForward forward = processActionPerform(request, response, action, form, mapping);

      // Process the returned ActionForward instance
      processForwardConfig(request, response, forward);

      //cerramos el contexto de jbpm.
      try{
      processCloseJbpm();
      }
      catch(Exception ex){
      ex.printStackTrace();
      //ex.toString();

      }
      }

      /**
      * Abrimos el contexto de jbpm que se usara en las Actions.
      */
      protected void processOpenJbpm(){

      JbpmContext ctx = JbpmContext.getCurrentJbpmContext();
      if( ctx == null ){

      JbpmConfiguration.getInstance().createJbpmContext();
      }


      }

      /**
      * Cerramos el contexto de jbpm comprobando si aun sigue abierto. Deberia seguir siempre abierto
      * llegados a este punto.
      *
      */
      protected void processCloseJbpm(){

      //se mira que no se haya cerrado previamente el contexto de jbpm.
      if( JbpmContext.getCurrentJbpmContext() != null ){
      if( JbpmContext.getCurrentJbpmContext().getSession().isOpen() ){

      JbpmContext.getCurrentJbpmContext().close();
      }
      }

      }
      where processActionPerform has most my integration with struts ActionForward (I overwrite some methods)
      On the other hand, I in the hibernate.cfg file JBPM tables plus my own tables, all against the same mySQL Schema.
      Well, every now and then, in a random way, i get the following error:

      13:49:27,168 [http-8080-Processor25] ERROR DbPersistenceService : problem rolling back after failed commit
      org.hibernate.TransactionException: Transaction not successfully started
      at org.hibernate.transaction.JDBCTransaction.rollback(JDBCTransaction.java:149)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:165)
      at org.jbpm.svc.Services.close(Services.java:211)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at net.cofb.gexp.struts.GexpRequestProcessor.processCloseJbpm(GexpRequestProcessor.java:200)
      at net.cofb.gexp.struts.GexpRequestProcessor.process(GexpRequestProcessor.java:153)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      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.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:868)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Unknown Source)
      org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:171)
      at org.jbpm.svc.Services.close(Services.java:211)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at net.cofb.gexp.struts.GexpRequestProcessor.processCloseJbpm(GexpRequestProcessor.java:200)
      at net.cofb.gexp.struts.GexpRequestProcessor.process(GexpRequestProcessor.java:153)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      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.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:868)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Unknown Source)
      Caused by: org.hibernate.TransactionException: Transaction not successfully started
      at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:100)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:161)
      ... 22 more
      13:49:27,184 [http-8080-Processor25] ERROR Services : problem closing service 'persistence'
      org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:171)
      at org.jbpm.svc.Services.close(Services.java:211)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at net.cofb.gexp.struts.GexpRequestProcessor.processCloseJbpm(GexpRequestProcessor.java:200)
      at net.cofb.gexp.struts.GexpRequestProcessor.process(GexpRequestProcessor.java:153)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      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.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:868)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Unknown Source)
      Caused by: org.hibernate.TransactionException: Transaction not successfully started
      at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:100)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:161)
      ... 22 more
      org.jbpm.JbpmException: problem closing services {persistence=org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session}
      at org.jbpm.svc.Services.close(Services.java:223)
      at org.jbpm.JbpmContext.close(JbpmContext.java:138)
      at net.cofb.gexp.struts.GexpRequestProcessor.processCloseJbpm(GexpRequestProcessor.java:200)
      at net.cofb.gexp.struts.GexpRequestProcessor.process(GexpRequestProcessor.java:153)
      at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1196)
      at org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:432)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      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.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:868)
      at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:663)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
      at java.lang.Thread.run(Unknown Source)
      Caused by: org.jbpm.persistence.JbpmPersistenceException: couldn't commit hibernate session
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:171)
      at org.jbpm.svc.Services.close(Services.java:211)
      ... 21 more
      Caused by: org.hibernate.TransactionException: Transaction not successfully started
      at org.hibernate.transaction.JDBCTransaction.commit(JDBCTransaction.java:100)
      at org.jbpm.persistence.db.DbPersistenceService.close(DbPersistenceService.java:161)
      ... 22 more

      Do anybody see anything?? any trace?? any light in this dark??
      THank you very much and best regards

        • 1. Re:
          saurabh gupta Newbie

          I think this problem could be a result of the JBPM-Hibernate combination which you use.
          By default the DB Persistence service being used by JBPMContext should start a transaction, in this case probably the same is not happening...

          check jbpmconfig.xml file within the jbpm identity jar file...