0 Replies Latest reply on Aug 8, 2005 6:59 AM by Daniel

    Bug found in JBpm 2.0 EJB

    Daniel Newbie

      Hi everybody!
      I'm using JBpm 2.0 in an EJB enviroment and I think I found a problem with it.
      Sometimes the application I wrote tries to get information about a process definition that doesn't exists in the JBpm database. Then it is thrown a runtime exception saying that the process definition was not found but the Hibernate conexion is not closed in Hibernate, so after a few operations the application crashes saying it can't obtain more Hibernate connections (as they are not being closed). I took a look at the EJB implementation in ExecutionServiceBean.java an I noticed that there are some methods like:

      public Token getToken( Long tokenId ) throws RemoteException {
      Token token = null;
      ExecutionService executionService = jbpmServiceFactory.openExecutionService(getActorId());
      token = executionService.getToken( tokenId );
      return token;

      that don't catch any exception so when a PersistenceException (runtime) is thrown at executionService.getToken() it never reaches the executionService.close() and the Hibernate conexion is never closed. Instead in the startProcessInstance for example there is a try catch with a finally where you close the execution service.
      I think there should be a finally method like that in every method.