title: Activiti - Business Rule Task Unit test java.lang.IncompatibleClassChangeError: Implementing class error
body: <p>I'm doing a <strong>JUnit test</strong> on my <strong>Activiti</strong> process containing Business Rule Task. I've implemented business rules in a DRL file (generated from a Excel <strong>Drools Decision Table</strong>). This last was successfully tested.</p>
  
  <p>My unit test is failing on the <strong>deploy</strong> instruction below : </p>
  
  <pre><code>RepositoryService repositoryService = activitiRule
      .getRepositoryService();
  
  repositoryService
      .createDeployment()
      .addClasspathResource(ruleFile)
      .addClasspathResource(bpmn20File)
      .deploy();
  </code></pre>
  
  <p>The associated stacktrace :</p>
  
  <pre><code>java.lang.IncompatibleClassChangeError: Implementing class
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:760)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:455)
  at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:367)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:360)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  at org.drools.rule.builder.RuleBuildContext.&lt;init&gt;(RuleBuildContext.java:73)
  at org.drools.compiler.PackageBuilder.addRule(PackageBuilder.java:2825)
  at org.drools.compiler.PackageBuilder.compileRules(PackageBuilder.java:970)
  at org.drools.compiler.PackageBuilder.compileAllRules(PackageBuilder.java:879)
  at org.drools.compiler.PackageBuilder.addPackage(PackageBuilder.java:871)
  at org.drools.compiler.PackageBuilder.addPackageFromDrl(PackageBuilder.java:466)
  at org.drools.compiler.PackageBuilder.addKnowledgeResource(PackageBuilder.java:694)
  at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:51)
  at org.drools.builder.impl.KnowledgeBuilderImpl.add(KnowledgeBuilderImpl.java:40)
  at org.activiti.engine.impl.rules.RulesDeployer.deploy(RulesDeployer.java:59)
  at org.activiti.engine.impl.persistence.deploy.DeploymentManager.deploy(DeploymentManager.java:50)
  at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:103)
  at org.activiti.engine.impl.cmd.DeployCmd.execute(DeployCmd.java:37)
  at org.activiti.engine.impl.interceptor.CommandInvoker.execute(CommandInvoker.java:24)
  at org.activiti.engine.impl.interceptor.CommandContextInterceptor.execute(CommandContextInterceptor.java:57)
  at org.activiti.engine.impl.interceptor.LogInterceptor.execute(LogInterceptor.java:31)
  at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:40)
  at org.activiti.engine.impl.cfg.CommandExecutorImpl.execute(CommandExecutorImpl.java:35)
  at org.activiti.engine.impl.RepositoryServiceImpl.deploy(RepositoryServiceImpl.java:78)
  at org.activiti.engine.impl.repository.DeploymentBuilderImpl.deploy(DeploymentBuilderImpl.java:156)
  at com.capgemini.com.XXX.iors.bpm.router.test.RouterProcessTest.startProcess(RouterProcessTest.java:43)
  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
  at java.lang.reflect.Method.invoke(Method.java:483)
  at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)
  at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)
  at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)
  at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)
  at org.activiti.engine.test.ActivitiRule$1.evaluate(ActivitiRule.java:126)
  at org.junit.rules.RunRules.evaluate(RunRules.java:20)
  at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)
  at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)
  at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)
  at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)
  at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)
  at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)
  at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)
  at org.junit.runners.ParentRunner.run(ParentRunner.java:309)
  at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:50)
  at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
  at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
  </code></pre>
  
  <p>The associated DRL file : </p>
  
  <pre><code>package com.capgemini.com.XXX.iors.bpm.router.rules;
  //generated from Decision Table
  import com.capgemini.com.XXX.iors.bpm.router.rules.*;
  global com.capgemini.com.XXX.iors.bpm.router.rules.RouterResult result;
  // rule values at C11, header at C6
  rule "RouterRule_11"
      when
          r:RouterInput(origin in ("system"), fileName.equals("System"))
      then
          result.setProcessIdentifier("SystemProcess");
  end
  
  // rule values at C12, header at C6
  rule "RouterRule_12"
      when
          r:RouterInput(origin in ("contracts", "contract"), fileName.equals("contract"))
      then
          result.setProcessIdentifier("ContractProcess");
  end
  
  // rule values at C13, header at C6
  rule "RouterRule_13"
      when
          r:RouterInput(origin in ("contracts", "contract"), fileName.equals("advcontract"))
      then
          result.setProcessIdentifier("AdvancedContractProcess");
  end
  </code></pre>
  
  <p>[EDIT1] The BPMN definition : </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:activiti="http://activiti.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://www.activiti.org/test"&gt;
    &lt;process id="myProcess" name="My process" isExecutable="true"&gt;
      &lt;startEvent id="startevent1" name="Start"&gt;&lt;/startEvent&gt;
      &lt;endEvent id="endevent2" name="End"&gt;&lt;/endEvent&gt;
      &lt;businessRuleTask id="routingTask" name="Routing Taks" activiti:ruleVariablesInput="${routerInput}" activiti:resultVariable="rulesOutput"&gt;&lt;/businessRuleTask&gt;
      &lt;sequenceFlow id="flow4" sourceRef="startevent1" targetRef="routingTask"&gt;&lt;/sequenceFlow&gt;
      &lt;sequenceFlow id="flow5" sourceRef="routingTask" targetRef="endevent2"&gt;&lt;/sequenceFlow&gt;
    &lt;/process&gt;
    &lt;bpmndi:BPMNDiagram id="BPMNDiagram_myProcess"&gt;
      &lt;bpmndi:BPMNPlane bpmnElement="myProcess" id="BPMNPlane_myProcess"&gt;
        &lt;bpmndi:BPMNShape bpmnElement="startevent1" id="BPMNShape_startevent1"&gt;
          &lt;omgdc:Bounds height="35.0" width="35.0" x="110.0" y="170.0"&gt;&lt;/omgdc:Bounds&gt;
        &lt;/bpmndi:BPMNShape&gt;
        &lt;bpmndi:BPMNShape bpmnElement="endevent2" id="BPMNShape_endevent2"&gt;
          &lt;omgdc:Bounds height="35.0" width="35.0" x="360.0" y="170.0"&gt;&lt;/omgdc:Bounds&gt;
        &lt;/bpmndi:BPMNShape&gt;
        &lt;bpmndi:BPMNShape bpmnElement="routingTask" id="BPMNShape_routingTask"&gt;
          &lt;omgdc:Bounds height="55.0" width="105.0" x="190.0" y="160.0"&gt;&lt;/omgdc:Bounds&gt;
        &lt;/bpmndi:BPMNShape&gt;
        &lt;bpmndi:BPMNEdge bpmnElement="flow4" id="BPMNEdge_flow4"&gt;
          &lt;omgdi:waypoint x="145.0" y="187.0"&gt;&lt;/omgdi:waypoint&gt;
          &lt;omgdi:waypoint x="190.0" y="187.0"&gt;&lt;/omgdi:waypoint&gt;
        &lt;/bpmndi:BPMNEdge&gt;
        &lt;bpmndi:BPMNEdge bpmnElement="flow5" id="BPMNEdge_flow5"&gt;
          &lt;omgdi:waypoint x="295.0" y="187.0"&gt;&lt;/omgdi:waypoint&gt;
          &lt;omgdi:waypoint x="360.0" y="187.0"&gt;&lt;/omgdi:waypoint&gt;
        &lt;/bpmndi:BPMNEdge&gt;
      &lt;/bpmndi:BPMNPlane&gt;
    &lt;/bpmndi:BPMNDiagram&gt;
  &lt;/definitions&gt;
  </code></pre>
  
  <p>RouterInput and RouterResult classes are simple getter/setter classes passed to the <strong>Activiti ruleVariablesInput &amp; ruleVariablesOuput fields</strong> to do the I/O on my Business Rule Task.</p>
  
  <p>How can I go beyong this IncompatibleClassChangeError issue ?</p>
  
  <p>Thanks in advance.</p>