Uploaded image for project: 'Red Hat Process Automation Manager'
  1. Red Hat Process Automation Manager
  2. RHPAM-1975

ServerTemplateConverter breaks with KieServerMode mixed-case

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 7.3.1.GA
    • 7.3.0.GA
    • Cloud
    • None
    • 2019 Week 11-13

    Description

      According to:
      https://issues.jboss.org/browse/KIECLOUD-121?focusedCommentId=13706622&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-13706622
      , the value of the org.kie.server.mode property should be case-insensitive. However, it is not, and the following exception is thrown if it receives a value other than all-uppercase:

      Caused by: java.lang.IllegalArgumentException: No enum constant org.kie.server.api.model.KieServerMode.production
      	at java.lang.Enum.valueOf(Enum.java:238)
      	at org.kie.server.api.model.KieServerMode.valueOf(KieServerMode.java:19)
      	at org.kie.server.controller.openshift.storage.ServerTemplateConverter.fromState(ServerTemplateConverter.java:123)
      	at java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:193)
      	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1382)
      	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
      	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
      	at java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:708)
      	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      	at java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:499)
      	at org.kie.server.controller.openshift.storage.OpenShiftServerTemplateStorage.load(OpenShiftServerTemplateStorage.java:97)
      	at org.kie.workbench.common.screens.server.management.backend.storage.ServerTemplateOCPStorage.load(ServerTemplateOCPStorage.java:58)
      	at org.kie.workbench.common.screens.server.management.backend.storage.ServerTemplateOCPStorage$Proxy$_$$_WeldClientProxy.load(Unknown Source)
      	at org.kie.server.controller.impl.service.SpecManagementServiceImpl.listServerTemplates(SpecManagementServiceImpl.java:165)
      	at org.kie.server.controller.impl.service.SpecManagementServiceImpl$Proxy$_$$_WeldClientProxy.listServerTemplates(Unknown Source)
      	at org.kie.workbench.common.screens.server.management.backend.service.SpecManagementServiceCDI.listServerTemplates(SpecManagementServiceCDI.java:132)
      	at org.kie.workbench.common.screens.server.management.backend.service.SpecManagementServiceCDI$Proxy$_$$_WeldClientProxy.listServerTemplates(Unknown Source)
      	at org.jbpm.workbench.ks.integration.KieServerIntegration.createAvailableClients(KieServerIntegration.java:103)
      	... 47 more
      

      The line in suspect is here:
      https://github.com/kiegroup/droolsjbpm-integration/blob/master/kie-server-parent/kie-server-controller/kie-server-controller-openshift/src/main/java/org/kie/server/controller/openshift/storage/ServerTemplateConverter.java#L123

      I believe this:

      template.setMode(KieServerMode.valueOf(mode));
      

      should be changed to:

      template.setMode(KieServerMode.valueOf(mode.toUpperCase()));
      

      A workaround of always setting the KIE_SERVER_MODE in the openshift templates to uppercase does not seem like enough, as:

      1. The templates already do that, and the error still happens.
      2. The openshift script code already uppercases the value anyways, so somewhere it is becoming lowercase:
        https://github.com/errantepiphany/jboss-kie-modules/blob/7.3.x/jboss-kie-kieserver/added/launch/jboss-kie-kieserver.sh#L485-L495

      Note: This error only happens with the rhpam73-managed.yaml template, and not any of the other templates (prod, authoring, etc.), as this only involves the openshift controller.

      Also, just to verify: The reason this error is happening in the workbench (BC Monitoring production scenario) is because the KIE Server - who registers itself with the workbench controller - is telling it what it's org.kie.server.mode is, correct?

      Attachments

        Issue Links

          Activity

            People

              evan.zhang@redhat.com Evan Zhang (Inactive)
              dward-se-jboss David Ward
              Jakub Schwan Jakub Schwan
              Jakub Schwan Jakub Schwan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: