Uploaded image for project: 'JBoss BPMS Platform'
  1. JBoss BPMS Platform
  2. RHBPMS-4560

[GSS](6.4.z)Allow users to configure the Executor JNDI name when using the EJB API

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Major
    • 6.4.2
    • None
    • jBPM Core
    • CR1
    • Workaround Exists
    • Hide

      Declare the async work item handler in kie-deployment-descriptor.xml using a valid JNDI name. This can be done using the kjar/META-INF/kie-deployment-descriptor.xml or a global file configured using the following system property: -Dorg.kie.deployment.desc.location=file:/my/custom/location/deployment-descriptor.xml

      <work-item-handler>
          <resolver>ejb</resolver>
          <identifier>org.jbpm.executor.impl.wih.AsyncWorkItemHandler</identifier>
          <parameters>
              <parameter xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">jndi:java:global/testEjb/jbpm-executor-ejb-6.5.0.Final-redhat-2/ExecutorServiceEJBImpl</parameter>
              <parameter xsi:type="xs:string" xmlns:xs="http://www.w3.org/2001/XMLSchema">org.jbpm.executor.commands.PrintOutCommand</parameter>
          </parameters>
          <name>async</name>
      </work-item-handler>
      

      We must also set keep all as the merge mode:

      KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(gav[0], gav[1], gav[2]);
      deploymentUnit.setMergeMode(MergeMode.KEEP_ALL);
      
      Show
      Declare the async work item handler in kie-deployment-descriptor.xml using a valid JNDI name. This can be done using the kjar/META-INF/kie-deployment-descriptor.xml or a global file configured using the following system property: -Dorg.kie.deployment.desc.location= file:/my/custom/location/deployment-descriptor.xml <work-item-handler> <resolver>ejb</resolver> <identifier>org.jbpm.executor.impl.wih.AsyncWorkItemHandler</identifier> <parameters> <parameter xsi:type= "xs:string" xmlns:xs= "http: //www.w3.org/2001/XMLSchema" >jndi:java:global/testEjb/jbpm-executor-ejb-6.5.0.Final-redhat-2/ExecutorServiceEJBImpl</parameter> <parameter xsi:type= "xs:string" xmlns:xs= "http: //www.w3.org/2001/XMLSchema" >org.jbpm.executor.commands.PrintOutCommand</parameter> </parameters> <name>async</name> </work-item-handler> We must also set keep all as the merge mode: KModuleDeploymentUnit deploymentUnit = new KModuleDeploymentUnit(gav[0], gav[1], gav[2]); deploymentUnit.setMergeMode(MergeMode.KEEP_ALL);
    • Hide

      Create an EAR with the following structure and add the jbpm EJB JARs to EAR/lib:

      EAR

      __lib
      __myApp.jar
      _META-INF/application.xml

      In application.xml declare the JAR as an EJB module:

      <?xml version="1.0" encoding="UTF-8"?>
      <application xmlns="http://xmlns.jcp.org/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" version="7">
        <application-name>testEjb</application-name>
        <display-name>Application for jBPM EJBs integration</display-name>
        <module>
          <ejb>jbpm-executor-ejb-6.5.0.Final-redhat-2.jar</ejb>
        </module>
        <module>
          <ejb>jbpm-services-ejb-impl-6.5.0.Final-redhat-2.jar</ejb>
        </module>
        <module>
          <ejb>myApp.jar</ejb>
        </module>
        <library-directory>lib</library-directory>
      </application>
      

      Use the jbpm API from myApp.jar and you should see the exception.

      Show
      Create an EAR with the following structure and add the jbpm EJB JARs to EAR/lib: EAR __lib __myApp.jar _META-INF/application.xml In application.xml declare the JAR as an EJB module: <?xml version= "1.0" encoding= "UTF-8" ?> <application xmlns= "http: //xmlns.jcp.org/xml/ns/javaee" xmlns:xsi= "http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation= "http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/application_7.xsd" version= "7" > <application-name>testEjb</application-name> <display-name>Application for jBPM EJBs integration</display-name> <module> <ejb>jbpm-executor-ejb-6.5.0.Final-redhat-2.jar</ejb> </module> <module> <ejb>jbpm-services-ejb-impl-6.5.0.Final-redhat-2.jar</ejb> </module> <module> <ejb>myApp.jar</ejb> </module> <library-directory>lib</library-directory> </application> Use the jbpm API from myApp.jar and you should see the exception.

    Description

      If we deploy the jBPM services EJB API, for example, in an EAR/lib and then try to use it from an EAR/jar, we will have the following exception:

      WARN  [org.jbpm.kie.services.impl.KModuleDeploymentService] (default task-1) Unexpected error while deploying unit be.mainsysgroup.loans:sandbox:1.0.1-SNAPSHOT: java.lang.RuntimeException: java.lang.IllegalArgumentException: Unable to look up object from jndi using name java:module/ExecutorServiceEJBImpl
      

      The executor is registered during the deployment of a kjar:

      https://github.com/droolsjbpm/jbpm/blob/6.5.x/jbpm-services/jbpm-services-ejb/jbpm-services-ejb-impl/src/main/java/org/jbpm/services/ejb/impl/DeploymentServiceEJBImpl.java#L182

      The problem is that the JNDI name used is only visible for the module where the EJB is deployed. A possible solution is a new system property that will allow users to configure the executor service JNDI name.

      Attachments

        Issue Links

          Activity

            People

              swiderski.maciej Maciej Swiderski (Inactive)
              rhn-support-wsiqueir William Siqueira
              Karel Suta Karel Suta
              Karel Suta Karel Suta
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: