ProcessEngineException: no process deployed

1,767 views
Skip to first unread message

iryna....@gmail.com

unread,
Oct 22, 2014, 7:47:30 AM10/22/14
to camunda-...@googlegroups.com
Hello dear Camunda-Devs,

i'm evaluating Camunda engine at the moment, and have got the following issue using it:

Given:
Vanilla Wildfly 8.0.0
Camunda as compiled dependency in a Maven-Project
Camunda is configered in the processes.xml as follows:
<process-engine name="spo-process-engine">
<configuration>org.camunda.bpm.engine.impl.cfg.StandaloneProcessEngineConfiguration</configuration>
<datasource>java:jboss/datasources/ProcessEngine</datasource>
<properties>
<property name="databaseSchemaUpdate">true</property>
<property name="jobExecutorActivate">true</property>
</properties>
</process-engine>

<process-archive name="spo-basic-process">
<process-engine>spo-process-engine</process-engine>
<properties>
<property name="isDeleteUponUndeploy">true</property>
<property name="isScanForProcessDefinitions">true</property>
</properties>
</process-archive>
</process-application>

In my sourcecode I use it as follows:
@Stateless
@Named
public class WorkflowService {

private static final String USER_ID_VARIABLE = "userId";

private static final String PROCESS_DEFINITION_KEY = "spo-basic-process";

@Inject
@ProcessEngineName(value = "spo-process-engine")
private RuntimeService runtimeService;

public ProcessInstance startWorkflowInstance(Long userId) {
Map<String, Object> variables = new HashMap<String, Object>();
variables.put(USER_ID_VARIABLE, userId);
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables);
return processInstance;
}
}

I wrote the following Arquillian test for it:
@RunWith(Arquillian.class)
public class WorkflowServiceTest {

@Deployment
public static WebArchive createDeployment() {
File[] resolvedFiles = Maven.resolver().loadPomFromFile("pom.xml").importCompileAndRuntimeDependencies()
.resolve().withTransitivity().asFile();

WebArchive webArchive = ShrinkWrap.create(WebArchive.class, "spo-process.war").addClass(WorkflowService.class)
.addAsLibraries(resolvedFiles)
.addAsWebResource("META-INF/processes.xml", "WEB-INF/classes/META-INF/processes.xml")
.addAsWebInfResource(EmptyAsset.INSTANCE, "beans.xml")
.addAsResource("META-INF/persistence.xml", "META-INF/persistence.xml")
.addPackage(WorkflowService.class.getPackage()).addPackage(SPO.class.getPackage())
.addAsResource("SPOBasicProcess.bpmn").addAsResource("SPOBasicProcess.png");
return webArchive;
}

@Inject
private WorkflowService workflowService;

@Test
@InSequence(1)
public void startWorkflowInstanceTest() {
ProcessInstance processInstance = workflowService.startWorkflowInstance(new Long(7000L));
Assert.assertNotNull(processInstance);
}
}

The test fails with the following error message:
org.camunda.bpm.engine.ProcessEngineException: no processes deployed with key 'spo-basic-process'

The test works just fine, when I just set a couple of breakpoints and try to debug the code. I assume, that during a normal test run, the PorcessDefinition has not been deployed yet (because the engine runs in it's own thread), at the moment as I try to load it again in the test method. During debugging though, the engine thread has enough time to deploy the process definition.

How can this problem be solved? Can I somehow tell the RuntimeService to wait untill the ProcessDefinition I'm looking for has been deployed and start a process inctanse afterwards? Or have I forgotten something by the configuration of the engine?

Thank you in advance for your help!

Regards,
Iryna.

Daniel Meyer

unread,
Oct 24, 2014, 8:16:27 AM10/24/14
to camunda-...@googlegroups.com, iryna....@gmail.com
Hi Iryna,

You do :

File[] resolvedFiles = Maven.resolver().loadPomFromFile("pom.xml").importCompileAndRuntimeDependencies()
.resolve().withTransitivity().asFile();

Could you provide us with the pom.xml (camunda sensitive parts) so that we can have a look at the maven configuration?

Thanks,
Daniel

Iryna Feuerstein

unread,
Oct 24, 2014, 8:28:50 AM10/24/14
to camunda-...@googlegroups.com
Hello Daniel,

here is my pom.xml (the relevant part of it):

<build>
      <plugins>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
               <source>1.7</source>
               <target>1.7</target>
            </configuration>
         </plugin>
         <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.1.1</version>
            <configuration>
               <failOnMissingWebXml>false</failOnMissingWebXml>
            </configuration>
         </plugin>
      </plugins>
   </build>
  
  
  <dependencies>
<dependency>
<groupId>org.jboss.arquillian</groupId>
<artifactId>arquillian-bom</artifactId>
<version>1.1.5.Final</version>
<scope>import</scope>
<type>pom</type>
</dependency>
  <dependency>
  <groupId>org.camunda.bpm</groupId>
  <artifactId>camunda-engine</artifactId>
  <version>7.1.0-Final</version>
  </dependency>
  <dependency>
  <groupId>org.camunda.bpm</groupId>
  <artifactId>camunda-engine-cdi</artifactId>
  <version>7.1.0-Final</version>
  </dependency>
  <dependency>
  <groupId>org.camunda.bpm.javaee</groupId>
  <artifactId>camunda-ejb-client</artifactId>
  <version>7.1.0-Final</version>
  </dependency>
  <dependency>
<groupId>com.fasterxml.uuid</groupId>
<artifactId>java-uuid-generator</artifactId>
<version>3.1.0</version>
</dependency>
 
  <dependency>
  <groupId>org.jboss.spec</groupId>
  <artifactId>jboss-javaee-7.0</artifactId>
  <version>1.0.1.Final</version>
  <type>pom</type>
  <scope>provided</scope>
  </dependency>
 
  <dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-remote</artifactId>
<version>8.0.0.Final</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>arquillian-core-api</artifactId>
<groupId>org.jboss.arquillian.core</groupId>
</exclusion>
</exclusions>
</dependency>

I'm not a maven expert, so I could of couse do something wrong with my dependency management. 

Greetings,
Iryna.

--
You received this message because you are subscribed to a topic in the Google Groups "camunda BPM users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/camunda-bpm-users/z8hrkSEWC18/unsubscribe.
To unsubscribe from this group and all its topics, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/camunda-bpm-users/df0899cd-529f-443e-97b2-36294fbef428%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Daniel Meyer

unread,
Oct 24, 2014, 8:45:49 AM10/24/14
to camunda-...@googlegroups.com, iryna....@gmail.com
Hi Iryna,

pom.xml seems to be OK. (I wanted to check whether you include camunda-ejb-client which you do).

does it help if you add 

@Inject
private ProcessApplicationInterface processApplication;


To the WorkflowService class?

Cheers,
Daniel

Iryna Feuerstein

unread,
Oct 24, 2014, 10:48:01 AM10/24/14
to camunda-...@googlegroups.com
Hi Daniel,

I've changed my code as follows:

process.xml:

  <process-archive name="spo-basic-process">
    <process-engine>spo-process-engine</process-engine>
    <properties>
      <property name="isDeleteUponUndeploy">true</property>
      <property name="isScanForProcessDefinitions">false</property>
    </properties>
  </process-archive>

WorkflowService.java:

    @Inject
    private ProcessApplicationInterface processApplication;

   public void deployProcessDefinition() {
        InputStream resourceAsStream = WorkflowEngineService.class.getResourceAsStream("/SPOBasicProcess.bpmn");
        BpmnModelInstance model = Bpmn.readModelFromStream(resourceAsStream);
        DeploymentBuilder deployment = repositoryService.createDeployment();
        deployment.addModelInstance("SPOBasicProcess.bpmn", model);
        processApplication.createDeployment("spo-basic-process", deployment);
        processApplication.deploy();
    }

    public String startWorkflowInstance(Long userId) {
        Map<String, Object> variables = new HashMap<String, Object>();
        variables.put("userId", userId);
        ProcessInstance processInstance = runtimeService.startProcessInstanceByKey("spo-basic-process", variables);
        return processInstance.getId();
    }

WorkflowServiceTest.java:

    @Test
    @InSequence(1)
    public void deployProcessDefinitionTest() {
        workflowService.deployProcessDefinition();
    }

    @Test
    @InSequence(2)
    public void startWorkflowInstanceTest() {
        String processInstanceId = workflowService.startWorkflowInstance(new Long(7000L));
        Assert.assertNotNull(processInstanceId);
    }

Is the ProcessApplicationInterface meant to be used like that? 

By running my test I still get the same Exception. The javadocs of ProcessApplicationInterface#deploy() says: on some containers (like JBoss AS 7) the deployment of the process application is performed asynchronously and via introspection at deployment time. This means that there is no guarantee that the process application is fully deployed after this method returns.

I assume that is exactly the problem that I'm getting here. Are there any workarounds for it?

--
You received this message because you are subscribed to a topic in the Google Groups "camunda BPM users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/camunda-bpm-users/z8hrkSEWC18/unsubscribe.
To unsubscribe from this group and all its topics, send an email to camunda-bpm-us...@googlegroups.com.
To post to this group, send email to camunda-...@googlegroups.com.

Christian Lipphardt

unread,
Oct 24, 2014, 10:52:27 AM10/24/14
to camunda-...@googlegroups.com, iryna....@gmail.com
Hi Iryna,

Could you please add your maven project (maybe remove sensible informations, like the process), so we can have a look at it.

Cheers,
Christian

Iryna Feuerstein

unread,
Oct 24, 2014, 12:05:18 PM10/24/14
to Christian Lipphardt, camunda-...@googlegroups.com
Also I would like to know how to clean up the database after my tests run. How can I force camunda to stop all running process instances, to remove all process definitions and to close the engine? I didn't found any example for this in camunda documentation and how-tos. Could you please give me an example?

Regards,
Iryna

Iryna Feuerstein

unread,
Oct 24, 2014, 12:07:32 PM10/24/14
to Christian Lipphardt, camunda-...@googlegroups.com
Hi Christian,

I have attached my maven project as zip file. As it is only an evaluation, the process definition in it doesn't really match our business process, so I let it unremoved. What I'm actually trying to do is to find out how does comunda work, in order to integrate it in our existing application and extract business logic from the client. So I would like to know:
 - which information about the process instance progress I can get at which state
 - how do I query for information needed
 - which approach of implementing of the functionalities is better suited for our needs (I meen implementing JavaDelegate, using existent EJBs by DI, adding Event Listeners, etc)

The tests you'll find in the exported project aren't up to date anymore as I've changed the process definition to try another approach. But they did worked! The only thing I don't like about them, are the calls of damn loopyLoop method. The reason I used it, is that e.q. the following to lines of code would fail:

       ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables);
        Task task = taskService.createTaskQuery().executionId(processInstance.getId()).singleResult();

The task query returns null, although there is a User Task immediately after the Start Event. But, if I wait for a moment after the start of the ProcessInstance, the query works just fine. What am I doing wrong?

2014-10-24 16:52 GMT+02:00 Christian Lipphardt <christian...@gmail.com>:
spo-process.zip

Christian Lipphardt

unread,
Oct 24, 2014, 12:25:47 PM10/24/14
to camunda-...@googlegroups.com, christian...@gmail.com, iryna....@gmail.com
Hi Iryna,

To get your process application working, you have to configure the process engine as a 'JtaProcessEngineConfiguration' in your processes.xml. When doing so, the engine will participate in the transactions of the application server and everything works. That was the problem with the deployment.

<process-engine name="spo-process-engine">
  <configuration>org.camunda.bpm.engine.impl.cfg.JtaProcessEngineConfiguration</configuration>
 <datasource>java:jboss/datasources/ProcessEngine</datasource>
   <properties>
   <property name="databaseSchemaUpdate">create-drop</property>
   <property name="jobExecutorActivate">true</property>
   <property name="transactionManagerJndiName">java:jboss/TransactionManager</property>
  </properties>
</process-engine>

Additional hints: 
There is no need to specify the databaseName in the process engine configuration, you can just leave it off. It will be auto-detected.


The code 
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(PROCESS_DEFINITION_KEY, variables);
Task task = taskService.createTaskQuery().executionId(processInstance.getId()).singleResult();
will then work too.

Cheers,
Christian

Christian Lipphardt

unread,
Oct 24, 2014, 12:28:22 PM10/24/14
to camunda-...@googlegroups.com, christian...@gmail.com, iryna....@gmail.com
You just have to configure the flag 'isDeleteUponUndeploy' in the process-archive's processes.xml to archive it.

Like 

<process-archive name="spo-basic-process">
    <process-engine>spo-process-engine</process-engine>
    <properties>
      <property name="isDeleteUponUndeploy">true</property>
      <property name="isScanForProcessDefinitions">true</property>
    </properties>
  </process-archive>

Cheers,
Christian

Iryna Feuerstein

unread,
Oct 24, 2014, 12:46:38 PM10/24/14
to Christian Lipphardt, camunda-...@googlegroups.com
Hi Christian,

it works just fine with the proper configuration!

Thank you very much guys for your quick help!

Greetings,
Iryna.

Christian Lipphardt

unread,
Oct 24, 2014, 12:52:05 PM10/24/14
to camunda-...@googlegroups.com, christian...@gmail.com, iryna....@gmail.com
No problem.

You can also remove these parts of your code:

@Inject
private ProcessApplicationInterface processApplication;

and any code related to it.
Deployments of processes will be performed by the engine when you enable the automatic scanning for it.
Like so:

  <process-archive name="spo-basic-process">
    <process-engine>spo-process-engine</process-engine>
    <properties>
      <property name="isDeleteUponUndeploy">true</property>
      <property name="isScanForProcessDefinitions">true</property>
    </properties>
  </process-archive>


I'm off, have a nice weekend.

Cheers,
Christian

Iryna Feuerstein

unread,
Oct 24, 2014, 12:54:43 PM10/24/14
to Christian Lipphardt, camunda-...@googlegroups.com
That was the approach I tryed to use first. With a wrong configuration though.

Have a nice weekend too!

Regards,
Iryna.
Reply all
Reply to author
Forward
0 new messages