3 Replies Latest reply on Apr 16, 2014 4:46 PM by newohybat

    jbpm6 custom ProcessEventListener

    whitakersp

      So I'm trying to create an event listener in jBPM6, running on eap 6, and I've created a class that implements ProcessEventListener.

       

      Right now all I'm doing is system outs for testing.  I deployed the jar into business-central.war/WEB-INF/lib.  With the same permissions as the rest of the jars in there.

       

      In the BPM Suite project authoring I edited the session to have a process event listener to point it at my class com.test.jbpm.TeamStrikeProcessEventListener.

       

      When I hit build & deploy

       

      I'm getting


      java.lang.ClassNotFoundException: com.test.jbpm.TeamStrikeProcessEventListener from [Module "org.drools:main" from local module loader @54031f94 (finder: local module finder @190e58a3 (roots: /test/apps/jboss/jboss-eap-6.1/modules,/test/apps/jboss/jboss-eap-6.1/modules/system/layers/bpms,/test/apps/jboss/jboss-eap-6.1/modules/system/layers/base))]


      If its in the lib directory why is it not being found.  Do I need to create a module in jboss just to have a custom class?  I don't want to reuse this jar outside of jbpm.


      Your help would be appreciated.


      Thanks


      Sean

        • 1. Re: jbpm6 custom ProcessEventListener
          whitakersp

          Well I added my jar as a dependency to org.drools to get it to see my implementation.  Now I've ran into another error. 

           

           

          Caused by: java.lang.RuntimeException: Cannot instance listener com.test.jbpm.TeamStrikeProcessEventListener

                  at org.drools.compiler.kie.util.CDIHelper.wireListnersAndWIHs(CDIHelper.java:44) [drools-compiler-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  at org.drools.compiler.kie.util.CDIHelper.wireListnersAndWIHs(CDIHelper.java:26) [drools-compiler-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  at org.jbpm.runtime.manager.impl.cdi.InjectableRegisterableItemsFactory.getWorkItemHandlers(InjectableRegisterableItemsFactory.java:150) [jbpm-runtime-manager-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  at org.jbpm.runtime.manager.impl.AbstractRuntimeManager.registerItems(AbstractRuntimeManager.java:79) [jbpm-runtime-manager-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  at org.jbpm.runtime.manager.impl.SingletonRuntimeManager.init(SingletonRuntimeManager.java:99) [jbpm-runtime-manager-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  at org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl.newSingletonRuntimeManager(RuntimeManagerFactoryImpl.java:71) [jbpm-runtime-manager-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  at org.jbpm.runtime.manager.impl.RuntimeManagerFactoryImpl$Proxy$_$$_WeldClientProxy.newSingletonRuntimeManager(RuntimeManagerFactoryImpl$Proxy$_$$_WeldClientProxy.java) [jbpm-runtime-manager-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  at org.jbpm.kie.services.impl.AbstractDeploymentService.commonDeploy(AbstractDeploymentService.java:83) [jbpm-kie-services-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  ... 53 more

          Caused by: java.util.NoSuchElementException

                  at com.google.common.collect.Iterators$1.next(Iterators.java:77) [guava-13.0.1-redhat-1.jar:13.0.1-redhat-1]

                  at org.drools.compiler.kie.util.CDIHelper$CDIBeanCreator.createBean(CDIHelper.java:119) [drools-compiler-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  at org.drools.compiler.kie.util.CDIHelper.wireListnersAndWIHs(CDIHelper.java:42) [drools-compiler-6.0.2-redhat-2.jar:6.0.2-redhat-2]

                  ... 60 more

           

          Not sure about this one.  My class implements ProcessEventListener, and now it is finding it.

           

          :/

          • 2. Re: jbpm6 custom ProcessEventListener
            wguo

            Same issue , there is little doc to describe it .

            • 3. Re: jbpm6 custom ProcessEventListener
              newohybat

              Hi,

              I had recently similar issue. The thing is, that the container can't find a bean of given type. My solution was to implement a producer method.

              In your case sth similar to:

              <code>

              import com.test.jbpm.TeamStrikeProcessEventListener;

              public class ListenerProducer {

                   @Produces

                   public TeamStrikeProcessEventListener getListener(){

                        return new TeamStrikeProcessEventListener();

                   }

              }

              </code>