Error with the camunda archetypes

I used the maven archetype

org.camunda.bpm.archetype:camunda-archetype-servlet-war

to create a project in intellij (2019.1.3). My java version is:

> java -version
openjdk version "12.0.1" 2019-04-16
OpenJDK Runtime Environment (build 12.0.1+12)
OpenJDK 64-Bit Server VM (build 12.0.1+12, mixed mode, sharing)

And since jdk 11 is supported I used File>Settings>Compiler>Java Compiler>Target bytecode version to select version 11 in intellij.

I first downloaded camunda Apache Tomcat (in C:\Camunda) (and later in order to follow the video tutorials wildfly (in C:\CamundaWildfly)).

Running the test “InMemoryH2Test” automatically generated by the maven archetype results in the following error:

    09:00:00.951 [main] DEBUG org.camunda.bpm.engine.test - ==== BUILDING PROCESS ENGINE ========================================================================
    09:00:01.081 [main] INFO  o.s.b.f.xml.XmlBeanDefinitionReader - Loading XML bean definitions from class path resource [camunda.cfg.xml]
    09:00:02.224 [main] INFO  org.camunda.bpm.engine.cfg - ENGINE-12003 Plugin 'SpinProcessEnginePlugin' activated on process engine 'default'
    09:00:02.229 [main] INFO  org.camunda.spin - SPIN-01010 Discovered Spin data format provider: org.camunda.spin.impl.json.jackson.format.JacksonJsonDataFormatProvider[name = application/json]
    09:00:02.404 [main] INFO  org.camunda.spin - SPIN-01010 Discovered Spin data format provider: org.camunda.spin.impl.xml.dom.format.DomXmlDataFormatProvider[name = application/xml]

    Test ignored.

    Test ignored.

    java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException

    	at org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat.defaultJaxBContextProvider(DomXmlDataFormat.java:165)
    	at org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat.<init>(DomXmlDataFormat.java:65)
    	at org.camunda.spin.impl.xml.dom.format.DomXmlDataFormat.<init>(DomXmlDataFormat.java:53)
    	at org.camunda.spin.impl.xml.dom.format.DomXmlDataFormatProvider.createInstance(DomXmlDataFormatProvider.java:32)
    	at org.camunda.spin.DataFormats.registerProvider(DataFormats.java:152)
    	at org.camunda.spin.DataFormats.registerCustomDataFormats(DataFormats.java:140)
    	at org.camunda.spin.DataFormats.registerDataFormats(DataFormats.java:124)
    	at org.camunda.spin.DataFormats.loadDataFormats(DataFormats.java:181)
    	at org.camunda.spin.plugin.impl.SpinProcessEnginePlugin.preInit(SpinProcessEnginePlugin.java:39)
    	at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.invokePreInit(ProcessEngineConfigurationImpl.java:943)
    	at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.init(ProcessEngineConfigurationImpl.java:770)
    	at org.camunda.bpm.extension.process_test_coverage.junit.rules.ProcessCoverageInMemProcessEngineConfiguration.init(ProcessCoverageInMemProcessEngineConfiguration.java:18)
    	at org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.buildProcessEngine(ProcessEngineConfigurationImpl.java:761)
    	at org.camunda.bpm.engine.impl.test.TestHelper.getProcessEngine(TestHelper.java:428)
    	at org.camunda.bpm.engine.test.ProcessEngineRule.initializeProcessEngine(ProcessEngineRule.java:172)
    	at org.camunda.bpm.engine.test.ProcessEngineRule.apply(ProcessEngineRule.java:154)
    	at org.camunda.bpm.extension.process_test_coverage.junit.rules.TestCoverageProcessEngineRule.apply(TestCoverageProcessEngineRule.java:399)
    	at org.junit.rules.RunRules.applyAll(RunRules.java:26)
    	at org.junit.rules.RunRules.<init>(RunRules.java:15)
    	at org.junit.runners.ParentRunner.withClassRules(ParentRunner.java:245)
    	at org.junit.runners.ParentRunner.classBlock(ParentRunner.java:194)
    	at org.junit.runners.ParentRunner.run(ParentRunner.java:362)
    	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
    	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
    	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
    	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
    	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)
    Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBException
    	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:583)
    	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
    	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
    	... 27 more


    Process finished with exit code -1

Any of my own test classes following the JUnit 4 guideline seem to result in the same error.

Hi @FelixB,

just add this dependency to your pom.xml:

    <dependency>
      <groupId>com.sun.xml.bind</groupId>
      <artifactId>jaxb-impl</artifactId>
      <version>2.2.4</version>
    </dependency>

Hope this helps, Ingo

2 Likes

Yes it did, but I still get

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.apache.ibatis.reflection.Reflector (file:/C:/Users/<redacted>/.m2/repository/org/mybatis/mybatis/3.4.4/mybatis-3.4.4.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.apache.ibatis.reflection.Reflector
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release

when running the automatically generated test.

And if I copy the example test for junit 4 into a new class “SuggestedTest” and import all the used classes and methods, I additionally get the error:

org.camunda.bpm.engine.exception.NullValueException: resource 'cleanMavenInstallation/SuggestedTest.ruleUsageExample.bpmn20.xml' not found: inputStream is null

	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:344)
	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:49)
	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:44)
	at org.camunda.bpm.engine.impl.repository.DeploymentBuilderImpl.addClasspathResource(DeploymentBuilderImpl.java:91)
	at org.camunda.bpm.engine.impl.test.TestHelper.annotationDeploymentSetUp(TestHelper.java:133)
	at org.camunda.bpm.engine.test.ProcessEngineRule.starting(ProcessEngineRule.java:146)
	at org.junit.rules.TestWatcher.startingQuietly(TestWatcher.java:108)
	at org.junit.rules.TestWatcher.access$000(TestWatcher.java:46)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:53)
	at org.camunda.bpm.engine.test.ProcessEngineRule$1.evaluate(ProcessEngineRule.java:165)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)


org.camunda.bpm.engine.exception.NullValueException: no processes deployed with key 'ruleUsage': processDefinition is null

	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:500)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:481)
	at org.camunda.bpm.engine.impl.util.EnsureUtil.generateException(EnsureUtil.java:344)
	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:49)
	at org.camunda.bpm.engine.impl.util.EnsureUtil.ensureNotNull(EnsureUtil.java:44)
	at org.camunda.bpm.engine.impl.persistence.deploy.cache.ProcessDefinitionCache.checkInvalidDefinitionByKey(ProcessDefinitionCache.java:48)
	at org.camunda.bpm.engine.impl.persistence.deploy.cache.ProcessDefinitionCache.checkInvalidDefinitionByKey(ProcessDefinitionCache.java:24)
	at org.camunda.bpm.engine.impl.persistence.deploy.cache.ResourceDefinitionCache.findDeployedLatestDefinitionByKey(ResourceDefinitionCache.java:63)
	at org.camunda.bpm.engine.impl.persistence.deploy.cache.DeploymentCache.findDeployedLatestProcessDefinitionByKey(DeploymentCache.java:82)
	at org.camunda.bpm.engine.impl.cmd.GetDeployedProcessDefinitionCmd.findByKey(GetDeployedProcessDefinitionCmd.java:84)
	at org.camunda.bpm.engine.impl.cmd.GetDeployedProcessDefinitionCmd.find(GetDeployedProcessDefinitionCmd.java:71)
	at org.camunda.bpm.engine.impl.cmd.GetDeployedProcessDefinitionCmd.execute(GetDeployedProcessDefinitionCmd.java:53)
	at org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:43)
	at org.camunda.bpm.engine.impl.cmd.StartProcessInstanceCmd.execute(StartProcessInstanceCmd.java:31)
	at org.camunda.bpm.engine.impl.interceptor.CommandExecutorImpl.execute(CommandExecutorImpl.java:24)
	at org.camunda.bpm.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:104)
	at org.camunda.bpm.engine.impl.interceptor.ProcessApplicationContextInterceptor.execute(ProcessApplicationContextInterceptor.java:66)
	at org.camunda.bpm.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:30)
	at org.camunda.bpm.engine.impl.ProcessInstantiationBuilderImpl.executeWithVariablesInReturn(ProcessInstantiationBuilderImpl.java:162)
	at org.camunda.bpm.engine.impl.ProcessInstantiationBuilderImpl.execute(ProcessInstantiationBuilderImpl.java:128)
	at org.camunda.bpm.engine.impl.ProcessInstantiationBuilderImpl.execute(ProcessInstantiationBuilderImpl.java:124)
	at org.camunda.bpm.engine.impl.RuntimeServiceImpl.startProcessInstanceByKey(RuntimeServiceImpl.java:80)
	at cleanMavenInstallation.SuggestedTest.ruleUsageExample(SuggestedTest.java:22)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:50)
	at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
	at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:47)
	at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
	at org.junit.rules.TestWatcher$1.evaluate(TestWatcher.java:55)
	at org.camunda.bpm.engine.test.ProcessEngineRule$1.evaluate(ProcessEngineRule.java:165)
	at org.junit.rules.RunRules.evaluate(RunRules.java:20)
	at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
	at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
	at org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
	at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
	at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
	at org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
	at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
	at org.junit.runners.ParentRunner.run(ParentRunner.java:363)
	at org.junit.runner.JUnitCore.run(JUnitCore.java:137)
	at com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:68)
	at com.intellij.rt.execution.junit.IdeaTestRunner$Repeater.startRunnerWithArgs(IdeaTestRunner.java:47)
	at com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:242)
	at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:70)

Hi @FelixB,

don’t care about the Warning.

How do deploy the bpmn file? Could you please post the complete test method?

Hope this helps, Ingo

I think I don’t understand what you mean with: “How do deploy the bpmn file?”

package cleanMavenInstallation;

import org.camunda.bpm.engine.test.ProcessEngineRule;
import org.camunda.bpm.engine.RuntimeService;
import org.camunda.bpm.engine.TaskService;
import org.camunda.bpm.engine.task.Task;
import org.junit.Rule;
import org.junit.Test;
import org.camunda.bpm.engine.test.Deployment;

import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

public class SuggestedTest {
        @Rule
        public ProcessEngineRule processEngineRule = new ProcessEngineRule();

        @Test
        @Deployment
        public void ruleUsageExample() {
                RuntimeService runtimeService = processEngineRule.getRuntimeService();
                runtimeService.startProcessInstanceByKey("ruleUsage");

                TaskService taskService = processEngineRule.getTaskService();
                Task task = taskService.createTaskQuery().singleResult();
                assertEquals("My Task", task.getName());

                taskService.complete(task.getId());
                assertEquals(0, runtimeService.createProcessInstanceQuery().count());
        }
}

Hi @FelixB,

I mean the @Deployment annotation.

If you don’t provide a resource, the annotation will look by default for a file named Classname.methodname.bpmn20.xml in folder named as the package name.

You can provide your bpmn file with @Deployment(resources = "my process file.bpmn")

Hope this helps, Ingo

1 Like

Thank you, I didn’t understand that I needed to reference the bpmn file for it to work. Does the bpmn file need to be deployed to the camunda server as well, or can it be tested without the upload?

If I understand it correctly InMemoryH2 refers to the fact that a camunda server is created in memory such that it does not need to be deployed to the camunda server?

Hi @FelixB,

The test will spin up an engine with an in-memory-datebase and deploy the process model before entering the test method.

When the test is completed, everything is removed from main memory.

Hope this helps, Ingo

1 Like

Hi @Ingo_Richtsmeier,

Yes this helped, thank you!

Hi Ingo,
Iam getting similar “JAxbExtensions” error when i ran groovy script.
Iam using groovy 3 & Java 13. How can i use this dependency into groovy script.

Caught: java.lang.NoClassDefFoundError: Unable to load class org.apache.groovy.jaxb.extensions.JaxbExtensions due to missing dependency javax/xml/bind/JAXBContext
java.lang.NoClassDefFoundError: Unable to load class org.apache.groovy.jaxb.extensions.JaxbExtensions due to missing dependency javax/xml/bind/JAXBContext
at org.codehaus.groovy.vmplugin.v5.Java5.configureClassNode(Java5.java:414)
at org.codehaus.groovy.ast.ClassNode.lazyClassInit(ClassNode.java:273)
at org.codehaus.groovy.ast.ClassNode.getMethods(ClassNode.java:395)

Thanks.

Hi @rprasad19,

I havn’t tried groovy by myself, but a quick google search about

lead to this link: The Apache Groovy programming language - Groovy 2.5 release notes

Hope this helps, Ingo

Thanks Ingo.