0
votes

I am running the kie-server-showcase docker image and attempting to run a very simple rule on it.

I start the container as so:

docker run -i -p 8080:8080 --name kie-server --mount type=bind,source=$HOME/.m2,target=/opt/jboss/.m2 jboss/kie-server-showcase:latest

I need to use a bind mount as I'm just using my local .m2 maven repository (for now) and this was the only way I could see to get the container to get a copy of it.

I have built a kjar in Eclipse via "maven clean" followed by "maven install". Inside the kjar (.jar) I have:

  • META-INF which contains kmodule.xml and MANIFEST.MF, also a maven subfolder which has the group-id followed by artifact-id in subfolders, i.e. META-INF > maven > group > artifact. The artifact folder contains the pom and pom.properties (which then defines the GAV).
  • my drl and bpmn

To create the container on the kie-server I use a curl command:

curl -u 'admin:admin' -H "accept: application/xml" -H "content-type: application/xml" -d @myContainer.xml -X PUT http://localhost:8080/kie-server/services/rest/server/containers/MyContainer

It then begins running the command but the time spent continues to tick on and was still going after I had left it for 30 minutes.

I checked the kie-server containers and the one I have added is there but the status is CREATING:

<response type="SUCCESS" msg="List of created containers">
    <kie-containers>
        <kie-container container-id="MyContainer" status="CREATING">
            <release-id>
                <artifact-id>hummingbird.rules.syndicated-kjar</artifact-id>
                <group-id>uk.co.cdl.hummingbird</group-id>
                <version>0.0.1-SNAPSHOT</version>
            </release-id>
            <scanner status="DISPOSED"/>
        </kie-container>
    </kie-containers>
</response>

I'm not very experienced with docker or using the kie-server, and in the past have not used kjars but had a custom rules engine that has loaded the drl and bpmn individually.

I believe it may be down to my kjar not being correct in some way. The docker container seems to see the kjar in the local maven repo mount (as I was previously getting errors that it couldn't find it).

The drl in the kjar is very simple:

package somerules

import org.json.JSONObject
import java.util.Map

rule "somerules - do something" ruleflow-group "somerules"
dialect "java"
when
        $root : Map()
then
        insert(new JSONObject());
        delete($root);
end

And the bpmn should not be an issue (it is the same one used previously with our custom rulesengine):

<?xml version="1.0" encoding="UTF-8"?> 
<definitions id="Definition"
             targetNamespace="http://www.jboss.org/drools"
             typeLanguage="http://www.java.com/javaTypes"
             expressionLanguage="http://www.mvel.org/2.0"
             xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation="http://www.omg.org/spec/BPMN/20100524/MODEL BPMN20.xsd"
             xmlns:g="http://www.jboss.org/drools/flow/gpd"
             xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI"
             xmlns:dc="http://www.omg.org/spec/DD/20100524/DC"
             xmlns:di="http://www.omg.org/spec/DD/20100524/DI"
             xmlns:tns="http://www.jboss.org/drools">

  <process processType="Private" isExecutable="true" id="somerules" name="somerules" tns:packageName="somerules" >

    <!-- nodes -->
    <startEvent id="_1"  isInterrupting="true"/>
    <endEvent id="_jbpm-unique-0" name="End" >
        <terminateEventDefinition />
    </endEvent>
    <businessRuleTask id="_jbpm-unique-2" name="somerules" g:ruleFlowGroup="somerules" >
      <ioSpecification>
        <inputSet>
        </inputSet>
        <outputSet>
        </outputSet>
      </ioSpecification>
    </businessRuleTask>

    <!-- connections -->
    <sequenceFlow id="_jbpm-unique-2-_jbpm-unique-0" sourceRef="_jbpm-unique-2" targetRef="_jbpm-unique-0" />
    <sequenceFlow id="_1-_jbpm-unique-2" sourceRef="_1" targetRef="_jbpm-unique-2" />

  </process>

  <bpmndi:BPMNDiagram>
    ...
  </bpmndi:BPMNDiagram>

</definitions>

I am building the kjar with drools 7.23.0.Final. I previously tried 7.22 as well.

Any advice appreciated, thanks.

1
FYI I have already seen this SO issue: stackoverflow.com/questions/51528493/… and also this separate issue: groups.google.com/forum/#!topic/drools-setup/4p2QrtrV5tY but neither have helped me.Neil
Try creating container in normal environment(without docker image), this will help to narrow down where exactly issue is. If issue persist in normal environment as well then collect 5-6 thread dump with interval of 20 secs. Thread dump will show status of each thread.Abhijit Humbe
Good idea @Abhijit, I tried it outside of Docker and could see the errors, resolved as per my answer. Thanks.Neil

1 Answers

0
votes

I found out what the issue was, mainly by following advice given and trying to run the kie-server without Docker.

I got a lot of error messages (which were not visible to me in Docker) regarding dependencies and errors along the lines of "class X and class Y disagree on Z attribute".

This was because my kjar pom had dependencies already provided in the kie-server and there seemed to be conflicts. It was all the drools dependencies. By setting the scope to "provided" in the kjar pom for these dependencies, the issue was resolved and I could create the container (both in Docker and non-Docker kie-servers).