cancel
Showing results for 
Search instead for 
Did you mean: 

ProcessEngine null

arag
Confirmed Champ
Confirmed Champ
Hello
I need help please!
I have a problem with the ProcessEngine when i try to init.
My code

public static void main(String[] args) {
        new update().updateFlow();
    }

    public void updateFlow() {
        pe = ProcessEngines.getDefaultProcessEngine();
        System.out.println("cargando"+pe);
        try {
            RepositoryService repositoryService = pe.getRepositoryService();
            String dep = repositoryService.createDeployment().addClasspathResource("test.bpmn20.xml").deploy().getId();
            System.out.println("deploy" + dep);
        } catch (Exception e) {
            e.printStackTrace();
        }
    }

Show me the message java.lang.NullPointerException. I work with Maven and activiti 6 beta4

Thans for your time
1 ACCEPTED ANSWER

hari
Star Contributor
Star Contributor

Hi, 

Looks like your processEngine itself is not created. Try with the below code by replacing Driver, URL, Username and Password appropriate to your environment. 

ProcessEngine processEngineInstance = ProcessEngineConfiguration
                                                                 .createStandaloneProcessEngineConfiguration()
                                                                 .setJdbcDriver(<DRIVER>)
                                                                 .setJdbcUrl(<URL>)
                                                                 .setJdbcPassword(<PASSWORD>)
                                                                 .setJdbcUsername(<USERNAME>)
                                                                 .buildProcessEngine();

View answer in original post

7 REPLIES 7

motorina0
Confirmed Champ
Confirmed Champ
Hi,

   Can you please:
     - provide the full stack trace (to see on what line the NPE occurs)
     - post the entire class using <code> <code> </code> tags
br,
Vlad

arag
Confirmed Champ
Confirmed Champ
thats all only show me java.lang.NullPointerException i work with netbeans.

arag
Confirmed Champ
Confirmed Champ
now show me this

Exception in thread "main" java.lang.NoClassDefFoundError: org/activiti/engine/ProcessEngines
at com.test.org.flow.update.updateFlow(update.java:29)
at com.test.org.flow.update.main(update.java:25)
Caused by: java.lang.ClassNotFoundException: org.activiti.engine.ProcessEngines
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
… 2 more

work with activiti 6 and the configuration of my pom archive is

<code>
<dependencies>
        <dependency>
            <groupId>org.activiti</groupId>
            <artifactId>activiti-engine</artifactId>
            <version>6.0.0.Beta4</version>
            <type>jar</type>
        </dependency>
       <dependency>
            <groupId>org.activiti</groupId>
            <artifactId>activiti-spring</artifactId>
            <version>6.0.0.Beta4</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.14</version>
        </dependency>
      
    </dependencies>
</code>

arag
Confirmed Champ
Confirmed Champ
please i need help i cant understand where is the problem. I created an java application and it works fine but with maven doesn´t work please!!!!!  help!!!

motorina0
Confirmed Champ
Confirmed Champ

Hi Ara,

   Sorry for the late reply, but only now I've received the email notification (??).

   It looks like the ProcessEngine class is not in your classpath, that is why you receive "NoClassDefFoundError".

   See: NoClassDefFoundError Javadoc

   You must make sure that:

     1. you run mvn clean install on your project, so that the activiti-engine jar is in your maven repo.

     2. make sure that the activiti-engine jar is in your projects classpath before running the main class

br,

Vlad

Hey Vlad - We had email notifications turned off during the migration. You shouldn't experience the delays in emails again! 

hari
Star Contributor
Star Contributor

Hi, 

Looks like your processEngine itself is not created. Try with the below code by replacing Driver, URL, Username and Password appropriate to your environment. 

ProcessEngine processEngineInstance = ProcessEngineConfiguration
                                                                 .createStandaloneProcessEngineConfiguration()
                                                                 .setJdbcDriver(<DRIVER>)
                                                                 .setJdbcUrl(<URL>)
                                                                 .setJdbcPassword(<PASSWORD>)
                                                                 .setJdbcUsername(<USERNAME>)
                                                                 .buildProcessEngine();