Can't deploy artifact to KIE-server via Drools

2019-07-30 17:24发布

问题:

I'm using the, kie-server-showcase and drools-workbench-showcase, via docker-run, I can see the kie-server in the drools UI and deploy a build to it.

However, when I use docker-compose, I get a runtime exception when trying to deploy the demo morgauge project, see the logs here: http://pastebin.com/qKQ8hgak, but I've included the interesting parts:

kie-server               | 15:24:41,268 INFO  [org.jboss.as] (Controller Boot Thread) JBAS015874: WildFly 8.2.0.Final "Tweek" started in 15690ms - Started 406 of 458 services (106 services are lazy, passive or on-demand)
kie-server               | 15:24:50,369 WARN  [org.kie.server.services.impl.controller.DefaultRestControllerImpl] (KieServer-ControllerConnect) Exception encountered while syncing with controller at http://kie_wb:8080/drools-wb/rest/controller/server/kie-server-3aec89f430c2 error Error while sending PUT request to http://kie_wb:8080/drools-wb/rest/controller/server/kie-server-3aec89f430c2 response code 405
kie-server               | 15:25:00,376 WARN  [org.kie.server.services.impl.controller.DefaultRestControllerImpl] (KieServer-ControllerConnect) Exception encountered while syncing with controller at http://kie_wb:8080/drools-wb/rest/controller/server/kie-server-3aec89f430c2 error Error while sending PUT request to http://kie_wb:8080/drools-wb/rest/controller/server/kie-server-3aec89f430c2 response code 405
kie-server               | 15:25:10,383 WARN  [org.kie.server.services.impl.controller.DefaultRestControllerImpl] (KieServer-ControllerConnect) Exception encountered while syncing with controller at http://kie_wb:8080/drools-wb/rest/controller/server/kie-server-3aec89f430c2 error Error while sending PUT request to http://kie_wb:8080/drools-wb/rest/controller/server/kie-server-3aec89f430c2 response code 405
kie-server               | 15:25:23,534 INFO  [org.kie.server.services.impl.controller.ControllerConnectRunnable] (KieServer-ControllerConnect) Connected to controller, quiting connector thread
kie-server               | 15:25:23,536 INFO  [org.kie.server.services.impl.ContainerManager] (EJB default - 5) About to install containers '[]' on kie server 'KieServer{id='kie-server-3aec89f430c2'name='kie-server-3aec89f430c2'version='6.4.0.Final'location='http://172.18.0.3:8080/kie-server/services/rest/server'}'
kie-server               | 15:26:17,419 WARN  [org.kie.scanner.embedder.MavenSettings] (default task-3) Environment variable M2_HOME is not set
kie-server               | 15:26:17,588 INFO  [org.kie.scanner.Aether] (default task-3) The local repository directory /opt/jboss/.m2/repository doesn't exist. Creating it.
kie-server               | 15:26:18,932 ERROR [io.undertow.request] (default task-5) UT005023: Exception handling request to /kie-server/services/rest/server/containers/demo: org.jboss.resteasy.spi.UnhandledException: java.lang.IllegalArgumentException: ConversationId not valid - missing releaseId

...

kie-server               | 15:26:19,231 WARN  [org.kie.scanner.MavenRepository] (default task-3) Unable to resolve artifact: mortgages:mortgages:0.0.1
kie-server               | 15:26:20,269 WARN  [org.kie.scanner.MavenRepository] (default task-3) Unable to resolve artifact: mortgages:mortgages:pom:0.0.1
kie-server               | 15:26:20,269 ERROR [org.kie.server.services.impl.KieServerImpl] (default task-3) Error creating container 'demo' for module 'mortgages:mortgages:0.0.1': java.lang.RuntimeException: Cannot find KieModule: mortgages:mortgages:0.0.1
kie-server               |  at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:117) [drools-compiler-6.4.0.Final.jar:6.4.0.Final]

Here's the docker-compose.yml files I use:

version: '2'

services:

  drools-wb:
    container_name: drools-wb
    image: jboss/drools-workbench-showcase:latest
    ports:
      - 8001:8001
      - 18080:8080
    networks:
      - mckinsey-net

  kie-server:
    container_name: kie-server
    image: jboss/kie-server-showcase:latest
    links:
      - drools-wb:kie_wb
    depends_on:
      - drools-wb
    environment:
      - HOME=/opt/jboss
      - JAVA_HOME=/usr/lib/jvm/java
      - JAVA_OPTS=-XX:MaxPermSize=256m -Xms256m -Xmx512m
      - JBOSS_BIND_ADDRESS=0.0.0.0
      - JBOSS_HOME=/opt/jboss/wildfly
      - KIE_CLASSIFIER=ee7
      - KIE_CONTEXT_PATH=kie-server
      - KIE_MAVEN_REPO=http://localhost:8080/kie-wb/maven2
      - KIE_MAVEN_REPO_PASSWORD=admin
      - KIE_MAVEN_REPO_USER=admin
      - KIE_REPOSITORY=https://repository.jboss.org/nexus/content/groups/public-jboss
      - KIE_SERVER_CONTROLLER_PWD=admin
      - KIE_SERVER_CONTROLLER_USER=admin
      - KIE_SERVER_LOCATION=http://localhost:8080/kie-server/services/rest/server
      - KIE_SERVER_PWD=kieserver1!
      - KIE_SERVER_USER=kieserver
      - KIE_VERSION=6.4.0.Final
      - KIE_WB_ENV_JAVA_HOME=/usr/lib/jvm/java
      - KIE_WB_ENV_JAVA_OPTS=-XX:MaxPermSize=256m -Xms256m -Xmx512m
      - KIE_WB_ENV_JBOSS_BIND_ADDRESS=0.0.0.0
      - KIE_WB_ENV_JBOSS_HOME=/opt/jboss/wildfly
      - KIE_WB_ENV_KIE_CLASSIFIER=wildfly8
      - KIE_WB_ENV_KIE_CONTEXT_PATH=drools-wb
      - KIE_WB_ENV_KIE_DEMO=true
      - KIE_WB_ENV_KIE_REPOSITORY=https://repository.jboss.org/nexus/content/groups/public-jboss
      - KIE_WB_ENV_KIE_SERVER_PROFILE=standalone-full-drools
      - KIE_WB_ENV_KIE_VERSION=6.4.0.Final
      - KIE_WB_ENV_WILDFLY_VERSION=8.2.0.Final
      - KIE_WB_NAME=/kie-server/kie_wb
      - KIE_WB_PORT=tcp://kie_wb:8001
      - KIE_WB_PORT_8001_TCP=tcp://kie_wb:8001
      - KIE_WB_PORT_8001_TCP_ADDR=kie_wb
      - KIE_WB_PORT_8001_TCP_PORT=8001
      - KIE_WB_PORT_8001_TCP_PROTO=tcp
      - KIE_WB_PORT_8080_TCP=tcp://kie_wb:8080
      - KIE_WB_PORT_8080_TCP_ADDR=kie_wb
      - KIE_WB_PORT_8080_TCP_PORT=8080
      - KIE_WB_PORT_8080_TCP_PROTO=tcp
      - KIE_WB_PORT_9990_TCP=tcp://kie_wb:9990
      - KIE_WB_PORT_9990_TCP_ADDR=kie_wb
      - KIE_WB_PORT_9990_TCP_PORT=9990
      - KIE_WB_PORT_9990_TCP_PROTO=tcp
      - PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
      - WILDFLY_VERSION=8.2.0.Final

I'm not sure why it can't resolve that artifact. Any ideas?

回答1:

You have to check basically two connections between the workbench and the kie-server, if they're running on different nodes - the HTTP ones provided by the kie-server REST endpoints and the system maven configuration on the kie-server as well, so it have to use the workbench as source repository for artifacts.

Looking at the stracktrace, I see some 405 errors when running the container and are probably related, endpoints are visible but not allowed... Did you try making some requests to the kie-server endpoints via some other client or command line? Have the user the right role? See example instructions here