I'm trying to develop custom rest application using jersery on top of activiti-rest, by including activiti-rest jars as a dependencies. when I deploy my custom rest app in tomcat I see process engine is creating twice. Here is the console ouput,
Jun 25, 2013 7:05:50 AM org.apache.catalina.core.ApplicationContext log INFO: Initializing Spring root WebApplicationContext 25 Jun 2013 07:05:50,398 [localhost-startStop-1] INFO org.springframework.web.context.ContextLoader:272 - Root WebApplicationContext: initialization started 25 Jun 2013 07:05:50,477 [localhost-startStop-1] INFO org.springframework.context.support.AbstractApplicationContext:500 - Refreshing Root WebApplicationContext: startup date [Tue Jun 25 07:05:50 CDT 2013]; root of context hierarchy 25 Jun 2013 07:05:50,531 [localhost-startStop-1] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader:315 - Loading XML bean definitions from class path resource [config/applicationContext.xml] 25 Jun 2013 07:05:50,727 [localhost-startStop-1] INFO org.springframework.beans.factory.xml.XmlBeanDefinitionReader:315 - Loading XML bean definitions from URL [file:/C:/Users/xprk825/apache-tomcat-servers/apache-tomcat-7.0.30%20-%20Activiti%205.12/webapps/custom-rest-api/WEB-INF/classes/activiti-context.xml] —– —- 25 Jun 2013 07:06:20,701 [localhost-startStop-1] DEBUG org.apache.ibatis.logging.slf4j.Slf4jImpl:47 - ==> Preparing: select * from ACT_GE_PROPERTY where NAME_ = ? 25 Jun 2013 07:06:20,720 [localhost-startStop-1] DEBUG org.apache.ibatis.logging.slf4j.Slf4jImpl:47 - ==> Parameters: schema.version(String) 25 Jun 2013 07:06:20,831 [localhost-startStop-1] INFO org.activiti.engine.impl.ProcessEngineImpl:81 - ProcessEngine default created Jun 25, 2013 7:06:23 AM org.apache.catalina.startup.HostConfig deployDirectory — — Jun 25, 2013 7:06:24 AM org.apache.catalina.startup.Catalina start INFO: Server startup in 39262 ms Jun 25, 2013 7:06:36 AM org.apache.catalina.core.ApplicationContext log INFO: RestletServlet: [Restlet] Attaching application: org.activiti.rest.application.ActivitiRestServicesApplication@711a638a to URI: /custom-rest-api/jas/activiti-service 25 Jun 2013 07:06:36,099 [http-bio-8080-exec-1] INFO org.activiti.engine.ProcessEngines:108 - Initializing process engine using Spring configuration 'file:/C:/Users/xprk825/apache-tomcat-servers/apache-tomcat-7.0.30%20-%20Activiti%205.12/webapps/custom-rest-api/WEB-INF/classes/activiti-context.xml'
As you can see process engine created when applicationContext.xml is loaded and the next time it is initialized when rest service is called.
and in the applicationContext.xml, I have imported the resource activiti-context.xml to initialize the process engine. Could you help to resolve the issue of process engine getting initialized twice.
Are you using the activiti-rest module in here as well? That expects a process engine with the name default. In ActivitiUtil this process engine is retrieved and if it's not there it's created. Maybe that's why you see the Engine being created twice.