AnsweredAssumed Answered

Unable to initiazlize process engine

Question asked by afshad on Mar 1, 2012
Latest reply on Mar 7, 2012 by afshad
I am unable to initialize the process engine. My code is as follows:
            ProcessEngines.init();
            ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
It returns processEngine as null.
I am not using the spring framework. Just a java project with the activiti jar and its other dependent jars.
The config file activiti.cfg.xml is what i got from the activiti setup:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans   http://www.springframework.org/schema/beans/spring-beans.xsd">

  <bean id="processEngineConfiguration" class="org.activiti.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration">
 
    <property name="jdbcUrl" value="jdbc:h2:mem:activiti;DB_CLOSE_DELAY=1000" />
    <property name="jdbcDriver" value="org.h2.Driver" />
    <property name="jdbcUsername" value="sa" />
    <property name="jdbcPassword" value="" />
   
    <!– Database configurations –>
    <property name="databaseSchemaUpdate" value="true" />
   
    <!– job executor configurations –>
    <property name="jobExecutorActivate" value="false" />
   
    <!– mail server configurations –>
    <property name="mailServerPort" value="5025" />   
  </bean>

</beans>

While debugging i see that in init(), there resources has no elements. What could be the cause of this??

  public synchronized static void init() {
    if (!isInitialized) {
      if(processEngines == null) {
        // Create new map to store process-engines if current map is null
        processEngines = new HashMap<String, ProcessEngine>();       
      }
      ClassLoader classLoader = ReflectUtil.getClassLoader();
      Enumeration<URL> resources = null;
      try {
        resources = classLoader.getResources("activiti.cfg.xml");
      } catch (IOException e) {
        throw new ActivitiException("problem retrieving activiti.cfg.xml resources on the classpath: "+System.getProperty("java.class.path"), e);
      }
////NOTE resources has no elements here. So never enters the while
      while (resources.hasMoreElements()) {
        URL resource = resources.nextElement();
        initProcessEnginFromResource(resource);
      }

Thank you.

Outcomes