Thanks that works!
But now i get a NullPointerException when trying to get the CaseService. This is my code:
package org.camunda.bpm.example.anmeldungbachelorarbeit;
import org.camunda.bpm.application.ProcessApplication;
import org.camunda.bpm.application.impl.EmbeddedProcessApplication;
import org.camunda.bpm.engine.CaseService;
import org.camunda.bpm.engine.ProcessEngine;
import org.camunda.bpm.engine.ProcessEngineConfiguration;
import org.camunda.bpm.engine.ProcessEngines;
import org.camunda.bpm.engine.variable.Variables;
@ProcessApplication(name = "Anmeldung Bachelorarbeit App CMMN", deploymentDescriptors = {"META-INF/processes.xml"})
public class AnmeldungBachelorarbeit extends EmbeddedProcessApplication {
public static void main(String[] args) {
AnmeldungBachelorarbeit anmeldungBachelorarbeit = new AnmeldungBachelorarbeit();
anmeldungBachelorarbeit.deploy();
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
CaseService caseService = processEngine.getCaseService();
caseService
.createCaseInstanceByKey(
"anmeldung_bachelorarbeit",
Variables
.createVariables()
.putValue("exposeAusreichend",
Variables.booleanValue(null))
.putValue("creditPoints",
Variables.integerValue(null)));
}
}
This is my processes.xml:
<?xml version="1.0" encoding="UTF-8" ?>
<process-application
xmlns="
http://www.camunda.org/schema/1.0/ProcessApplication"
xmlns:xsi="
http://www.w3.org/2001/XMLSchema-instance">
<process-engine name="my-engine">
<configuration>org.camunda.bpm.engine.impl.cfg.StandaloneInMemProcessEngineConfiguration</configuration>
</process-engine>
<process-archive name="loan-approval-cmmn">
<process-engine>my-engine</process-engine>
<properties>
<property name="isDeleteUponUndeploy">false</property>
<property name="isScanForProcessDefinitions">true</property>
</properties>
</process-archive>
</process-application>
This is the console output:
Jul 08, 2015 11:38:48 AM org.camunda.bpm.container.impl.deployment.ParseProcessesXmlStep parseProcessesXmlFiles
INFORMATION: Found process application file at file:/C:/Users/David/Documents/workspace/Camunda%20Test/target/classes/META-INF/processes.xml
log4j:WARN No appenders could be found for logger (org.apache.ibatis.logging.LogFactory).
log4j:WARN Please initialize the log4j system properly.
Jul 08, 2015 11:38:54 AM org.camunda.bpm.engine.impl.db.sql.DbSqlSession executeSchemaResource
INFORMATION: performing create on engine with resource org/camunda/bpm/engine/db/create/activiti.h2.create.engine.sql
Jul 08, 2015 11:38:54 AM org.camunda.bpm.engine.impl.db.sql.DbSqlSession executeSchemaResource
INFORMATION: performing create on history with resource org/camunda/bpm/engine/db/create/activiti.h2.create.history.sql
Jul 08, 2015 11:38:54 AM org.camunda.bpm.engine.impl.db.sql.DbSqlSession executeSchemaResource
INFORMATION: performing create on identity with resource org/camunda/bpm/engine/db/create/activiti.h2.create.identity.sql
Jul 08, 2015 11:38:54 AM org.camunda.bpm.engine.impl.db.sql.DbSqlSession executeSchemaResource
INFORMATION: performing create on case.engine with resource org/camunda/bpm/engine/db/create/activiti.h2.create.case.engine.sql
Jul 08, 2015 11:38:55 AM org.camunda.bpm.engine.impl.db.sql.DbSqlSession executeSchemaResource
INFORMATION: performing create on case.history with resource org/camunda/bpm/engine/db/create/activiti.h2.create.case.history.sql
Jul 08, 2015 11:38:55 AM org.camunda.bpm.engine.impl.SchemaOperationsProcessEngineBuild checkHistoryLevel
INFORMATION: No historyLevel property found in database.
Jul 08, 2015 11:38:55 AM org.camunda.bpm.engine.impl.SchemaOperationsProcessEngineBuild dbCreateHistoryLevel
INFORMATION: Creating historyLevel property in database with value: audit
Jul 08, 2015 11:38:55 AM org.camunda.bpm.engine.impl.ProcessEngineImpl <init>
INFORMATION: ProcessEngine my-engine created
Jul 08, 2015 11:38:55 AM org.camunda.bpm.container.impl.deployment.DeployProcessArchiveStep logDeploymentSummary
INFORMATION: Deployment summary for process archive 'loan-approval-cmmn':
bachelorarbeit-anmelden.cmmn10.xml
Jul 08, 2015 11:38:56 AM org.camunda.bpm.engine.impl.application.ProcessApplicationManager logRegistration
INFORMATION: ProcessApplication 'Process Application' registered for DB deployments [26922d08-2555-11e5-ac4f-0026b90c6990]. Deployment does not provide any process definitions.
Will execute case definitions
anmeldung_bachelorarbeit[version: 1, id: anmeldung_bachelorarbeit:1:2712a7aa-2555-11e5-ac4f-0026b90c6990]
Jul 08, 2015 11:38:56 AM org.camunda.bpm.container.impl.RuntimeContainerDelegateImpl deployProcessApplication
INFORMATION: Process Application Process Application successfully deployed.
Exception in thread "main" java.lang.NullPointerException
at org.camunda.bpm.example.anmeldungbachelorarbeit.AnmeldungBachelorarbeit.main(AnmeldungBachelorarbeit.java:21)