1 Reply Latest reply on Dec 10, 2014 1:40 AM by swiderski.maciej

    RuntimeManager with id default-per-request is already active

    sebastianbanasik

      Hello, every second time after redeploy when I try to run process i got the :

      "IllegalStateException: RuntimeManager with id default-per-request is already active".

       

      Below my startProcess procedure. What is the problem?

       

      public ProcessInfo startProcess(final String processId, final Map<String, Object> parameters) {

         

              RuntimeEngine runtimeEngine= null;

              try{

                  runtimeEngine = runtimeManager.getRuntimeEngine(EmptyContext.get());

                  KieSession kieSession = runtimeEngine.getKieSession();

         

                  ProcessInstance process = kieSession.startProcess(processId, parameters);

                  Map<String, Object> metaData = ((WorkflowProcessInstanceImpl) process).getMetaData();

                  Map<String, Object> variables = ((WorkflowProcessInstanceImpl) process).getVariables();

                  ProcessInfo pi = new ProcessInfo(process.getProcessName(), process.getId(), process.getProcessId(),

                          process.getState());

                  return pi;

              }

              catch(Exception e){

                  if (runtimeEngine != null){

                      runtimeManager.disposeRuntimeEngine(runtimeEngine);

                  }

                  throw e;

              }       

          }

        • 1. Re: RuntimeManager with id default-per-request is already active
          swiderski.maciej

          this error means that you recreating runtime manager with same identifier without previous closing one that was active. So either avoid recreating runtime manager or close it properly.

           

          If you mean redeploy of a application on application server then make sure that you close RuntimeManager instance on undeploy. Depending on what is your technology stack there are different options to do so.Consider RuntimeManager to be initialized on application start and closed on application shutdown.

           

          HTH