jBPM 6 web application examples

After a long time, let’s see new technology in action. jBPM 6 was released in the end of the last year, so it’s quite fresh and still lacks good examples to easily start with. I’ll focus on my recent example projects, which demonstrate jBPM 6 in use as a workflow engine embedded inside a web application.

rewards-basic application

So far the git repo contains just two projects. The first one is called rewards-basic. It was developed by Toshiya Kobayashi, who created the original application using jBPM 5 and Java Enterprise Editon (EE) 5. I’ve rewritten his application to work with new jBPM 6 and also later standard Java EE 6. There are many useful improvements in the new engine. For example now you can use runtime managers with advanced session strategies to better separate process contexts or to gain a better performance, especially in concurrent environment. Seamless integration with Java EE world is done by Context and Dependency Injection (CDI). Many people still don’t like CDI, but once you learn it, you may realize its advantages. You may even continue to use jBPM without CDI and initialize your environment using ordinary Java constructors or factories.

Both applications are build around one simple business process. After start it creates a task for user John and after he approves his task, the process creates a second task for user Mary. After she approves her task, the process finishes. Example applications provide web interfaces to these operations – in particular to start a business process, to list human tasks available and to approve them. More information including steps how to run the programs can be found on Github link above.

ProcessBean class

This article focuses on internal structure suitable to software developers. Let’s start and take a look on a code snippet from a process service Enterprise Java Bean (EJB):

@Inject
@Singleton
private RuntimeManager singletonManager;

This demostrates CDI and how it can be used. You can just inject an object of defined class to your bean and you don’t have to care about how and where it is initialized. Don’t worry, we’ll get to that! The second annotation is interesting as well. You may choose also others for advanced session strategies like @PerProcessInstance and @PerRequest. Their names are self-explanatory, just to be sure – the first one keeps session (context) for a process instance and the second one is just stateless, no state is kept. What can be done with the runtime manager then?

RuntimeEngine runtime = singletonManager.getRuntimeEngine(EmptyContext.get());
KieSession ksession = runtime.getKieSession();
...
ProcessInstance processInstance = ksession.startProcess("com.sample.rewards-basic", params);

Keep in mind that runtime manager usually follows singleton design pattern in your application. For each request you should get an instance of runtime engine from it based on the context. Note that runtime engine is just an encapsulation of a kie session and a task service. The session can be used to start a process instance. The task service is automatically linked to this session and can be used for human task related queries and commands. The last command just starts a process instance, so the business process is finally running.

The last thing that can be noted are user transactions. You don’t have to use user transactions, but they are useful in many cases. For example you may want to save some information into a corporate database at the same time with the execution of the process engine. This way you ensure that all operations are either committed or rolled back together.

TaskBean class

Similarly you can just simply inject a task service. Do you remember jBPM 5? The task service was decoupled from the process engine and had to be connected to the engine for each process run in order to support human tasks. jBPM 6 integrated the task service back to the engine.

@Inject
TaskService taskService;
...
List list = taskService.getTasksAssignedAsPotentialOwner(actorId, "en-UK");

As you can see in TaskBean, you can easily run an arbitrary task service method.

CDI producer classes

In order to get CDI working you have to provide producers for injected class instance where necessary. One of the CDI advantages is the loose coupling. For example you may use a service in your beans, which functionality is dependent on running application server. This is ok, but how to easily unit test your application without setting up awkward application server? For example you can easily write a mock service for unit testing and don’t even have to modify a Java code. All you would have to do is just to change an alternative class in CDI configuration file beans.xml.

On the other hand debugging a CDI application may be difficult as the errors of unsatisfied dependencies are thrown mostly during run time, which slows the development process. If you know how to cope with this, please leave me a comment, thanks!

Application scoped producers

These producers can be found in ApplicationScopedProducer class. @ApplicationScoped annotation tells the application server (or more precisely the CDI container), that instances produced here should be instantiated for the whole life cycle of this web application deployment. It’s logical – for example the persistence unit (database connection) won’t change during the runtime of the web application.

Very important is also the RuntimeEnvironment producer, which provides whole setup for runtime manager, for example including our “com.sample.rewards-basic” process definition to be used. Runtime manager is injected from a jBPM library, but this same library also internally injects RuntimeEnvironment instance to get our environment that it doesn’t know.

You may also notice RewardsUserGroupCallback class. It is a simple user group callback and is defined as an alternative. This demonstrates that by using alternatives you may use your own classes, if you are not satisfied with prepared implementations coming from jBPM libraries.

Presentation layer

Web presentation layer is really simple. It uses Java Server Pages (JSP) technology and Java Servlets to handle presentation logic. Web user interface is just plain HTML, because the focus was put on demonstrating the internal service logic.

rewards-jsf

The second example application stays internally mostly the same, based on the same concepts. However Java Server Faces (JSF) technology including CDI is used for presentation layer.

Summary

I have described briefly two simple web applications demonstrating together jBPM 6 and Java EE 6. Please write a comment if you’ve liked them or if you have some feedback, I would be happy to hear your opinion. Thanks.

Advertisements

37 thoughts on “jBPM 6 web application examples

  1. agiertli

    Really thanks for this !
    Especially for the additional comments in this blog post regarding the producer classes and the JSF example.

    Cheers,
    Anton.

    Reply
  2. Amol

    Hi Jiri, many thanks for this. I have configured rewards basic application to run with MySql, it runs fine. I copied the application, created another process and mentioned actor name as my name in human task properties. Also added my name in class RewardsUserGroupCallback.java and userinfo.properties, TaskServlet.java. I can start the process, start the human task but task doesn’t get placed on my name. So taskService.getTasksAssignedAsPotentialOwner(actorId, “en-UK”); returns nothing. But when I modify task actor as John, it run fine. Can you advice what I am missing?

    Reply
    1. jsvitak Post author

      Hi Amol,
      you have to also add this user name to the actor field of the human task inside the business process definition. This can be done in Eclipse using the BPMN2 modeler, or you may have to upload this bpmn2 process definition to web based kie workbench and modify it there. You can have multiple actors separated by commas (in this case only john for the first human task). Or you can specify a group of users that are allowed to claim this task. Wire between actors and groups is done in *UserGroupCallback class.

      Hope that helps,
      Jiri

      Reply
  3. goutham

    nice one kris , what strategy would you suggest for using runtime manager in container managed transactions

    Reply
    1. jsvitak Post author

      Hi,
      I am not Kris šŸ™‚

      Do you mean jBPM session strategy? Session strategies were introduced not because of transactions, but there were other needs, for example to isolate session context for different process instances. So for example if you need to separate session context for each process instance, I would use ‘per process instance’ session strategy. See the official docs for more info on strategies.

      Regards,
      Jiri

      Reply
  4. Alejo

    Thanks for this, I could run the rewards-basic application and see how it works, but I want to change from eclipse, could you please help me?
    I have not been able to create a web project in eclipse with jbpm and create the same application, you can guide me please?

    Reply
    1. jsvitak Post author

      The project is maven based, that means that you can open it in every IDE that supports maven. It does not depend on Eclipse. So I recommend to use maven to make your application IDE independent. Later you have to add jbpm dependencies to your pom.xml. How you define structure of your application is solely up to you. My application uses CDI a lot and this technology gives you free hands, but at the same time it may be more difficult to design something when you don’t have much guidelines. How you name your packages or classes it’s up to your choice.
      Maven has archetypes, which you can use to generate a project based on a template. Unfortunately I am not aware of such ‘jbpm web application archetype’ so far.

      Hope that helps,
      Jiri

      Reply
  5. micke

    Just for fun I tried to change the name mary to mike in the files in the project and then it stopped working. I guess the john and mary names are hard coded into the UserGroupsAssignmentsOne.mvel file inside the jbpm-human-task-core.6.0.1.Final.jar. The RewardsUserGroupCallback class is never called when I try and debug the example.

    So how do one get the user/group handling to work properly?

    Reply
  6. Tex Albuja

    Thanks for your support, it works . I’m facing a problem when I start a process, kie-wb don’t reflects these changes in Process Administration > Process Instances. I need to follow the proces flow and variables from the jbpm-console.

    Reply
    1. jsvitak Post author

      Hello Tex,

      These examples are to demonstrate how to build your own standalone web application. These examples are not designed for kie workbench. I am sorry I do not understand your point.

      Reply
    1. Dinusha Ambagahawita

      Hi jsvitak,

      One question. I can see when its started a new process its getting assigned to user ‘John’. But if i changed the user to someone else in the diagram and try to retrieve the tasks using that new user name, then its not working. I can see user JBPM tables are not populated with that new user. Where we are giving that newly started processors should come under user ‘John’. I changed the diagram actor, property file and RewardsUserGroupCallback with the new user name, but no success. Any idea for this?

      Thanks in advance!

      Reply
      1. jsvitak Post author

        Hello Dinusha,
        I have tried your steps with new library version (6.0.3-redhat-4) and it works for me. You have to:

        1. Change the user id in process definition.
        2. Change the user in RewardsUserGroupCallback class.
        3. Not necessary for this case, but for other features like task escalation – update also userinfo.properties.
        4. Update index page of the example.

        Now different users work for me. Of course in real situations you may consider usage of user groups.

        Hope that helps,
        Jiri

  7. Mean

    Hi,
    Thanks a lot for your example.
    When I tried to run it using MySQL, it throws an exception and does not get deployed. Have you tried using MySQL in persistence.xml
    Thanks,
    Meena

    Reply
    1. jsvitak Post author

      Hello,
      What kind of exception? You have to configure your datasource and jdbc driver in JBoss EAP, refer to EAP documentation. In my example you have to change only hibernate dialect in persistence.xml.
      HTH,
      Jiri

      Reply
  8. Steven

    Hi Jiri,
    Nice work. It is an very good tutorial. I am a newbie to jBPM and CDI/Weld.
    I just finished one demo project exactly following your reward-basic project structure, using jBPM6.0.1.Final + EJB3(CMT) + JSP2.5. I tried out PostgreSQL9.1 and H2 as database. Basically my functionalities are similiar to the project in this article https://community.jboss.org/people/roxy1987/blog/2013/01/22/jbpm5-web-application-example
    . I had four human tasks which have own jsp form to collect data and feedback from end user, and send the jBPM to evaluate rule and route to next service task or human task. Now it can work. But I note that some wired problems:
    1) I can’t deploy my project separately (I mean I just only deploy it in JBoss), and it always deployed failed. I also tried your war, and the result is same. It always complained missing some dependencies. But when I first deploy jbpm-console.war and dashboard-builder.war and then deploy mine or yours, mine or yours works well.
    2) After I deploy successfully jbpm-console.war and dashboard-builder.war and my war. I can finish all actions on my application. But if I access the jbpm console and then access my application, it doesn’t work, complaining a Hibernate jdbc connection exception: org.hibernate.service.UnknownServiceException: Unknown service requested [org.hibernate.service.jdbc.connections.spi.ConnectionProvider]

    it seems my app is missing some configuration. but I don’t have any idea. is it possible multiple jbpm runtimes are not allowed in one JVM?

    Reply
    1. jsvitak Post author

      Hi Steven,
      Each deployment in EAP 6 has its classloader, so there should not be any jBPM library conflicts.
      1.) The project is designed for EAP, so it has several dependencies marked as provided. They will be provided by JBoss EAP. For other container like Tomcat, you have to create new bundle with dependencies included. New Maven profile could help to solve this.
      2.) Unfortunately I am not familiar with the exception you mention.

      Jiri

      Reply
  9. Inoshika

    Hi,

    Thanks you very much for this wonderful example.
    I want to send the processes and tasks to Kie workbench when it is invoked from jsp pages. I have written the logic using RemoteRestAPI. If I do everything (start the process, complete tasks) using one button click, it is working fine. However, If I break it into several pages like start process instance in one page, complete of first task in one page and etc, it is not working. I am getting an error “org.jboss.resteasy.spi.ReaderException: java.lang.IllegalStateException: JBAS016071: Singleton not set for ModuleClassLoader for Module “deployment.Example.war:main” from Service Module Loader. This means that you are trying to access a weld deployment with a Thread Context ClassLoader that is not associated with the deployment”. When I restart the jboss, I can start a process or complete a task for the first time. After that, it give the above error.
    Do you have idea what needs to be done?I am struggling with this for sometime.
    Thank you very much

    Inoshika

    Reply
  10. Inoshika

    Hi,

    I cannot see the tasks to be completed after restarting the jboss. What needs to be done to resolve this?

    Thanks in advance,

    Reply
  11. george

    Hi jsvitak,
    Thanks for the rewards examples.
    I am able to deploy and run rewards-basic . But not able to deploy and run rewards-jsf.
    It will be great help if you help me to solve the problem
    Following is the error i am facing
    ============================
    07:27:53,870 INFO [stdout] (ServerService Thread Pool — 48) wagon http use multi threaded http connection manager maxPerRoute 20, max total 40
    07:27:54,551 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool — 48) MSC000001: Failed to start service jboss.deployment.unit.”rewards-jsf.war”.component.ProcessBean.START: org.jboss.msc.service.StartException in service jboss.deployment.unit.”rewards-jsf.war”.component.ProcessBean.START: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
    at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:57) [jboss-as-ee-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_21]
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334) [rt.jar:1.7.0_21]
    at java.util.concurrent.FutureTask.run(FutureTask.java:166) [rt.jar:1.7.0_21]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
    at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
    at org.jboss.threads.JBossThread.run(JBossThread.java:122) [jboss-threads-2.1.1.Final-redhat-1.jar:2.1.1.Final-redhat-1]
    Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:164) [jboss-as-ee-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:135) [jboss-as-ee-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.as.ee.component.BasicComponent.createInstance(BasicComponent.java:90) [jboss-as-ee-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.as.ejb3.component.singleton.SingletonComponent.getComponentInstance(SingletonComponent.java:122) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.as.ejb3.component.singleton.SingletonComponent.start(SingletonComponent.java:137) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.as.ee.component.ComponentStartService$1.run(ComponentStartService.java:54) [jboss-as-ee-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    … 7 more
    Caused by: javax.ejb.EJBException: java.lang.RuntimeException: Cannot find KieModule: org.jbpm.examples:rewards:1.0
    at org.jboss.as.ejb3.tx.BMTInterceptor.handleException(BMTInterceptor.java:78) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.as.ejb3.tx.EjbBMTInterceptor.checkStatelessDone(EjbBMTInterceptor.java:92) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:107) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.as.ejb3.tx.BMTInterceptor.processInvocation(BMTInterceptor.java:56) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ejb3.component.interceptors.CurrentInvocationContextInterceptor.processInvocation(CurrentInvocationContextInterceptor.java:41) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.ContextClassLoaderInterceptor.processInvocation(ContextClassLoaderInterceptor.java:70) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.ChainedInterceptor.processInvocation(ChainedInterceptor.java:61) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ee.component.BasicComponent.constructComponentInstance(BasicComponent.java:162) [jboss-as-ee-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    … 12 more
    Caused by: java.lang.RuntimeException: Cannot find KieModule: org.jbpm.examples:rewards:1.0
    at org.drools.compiler.kie.builder.impl.KieServicesImpl.newKieContainer(KieServicesImpl.java:108)
    at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.getDefault(RuntimeEnvironmentBuilder.java:180)
    at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.getDefault(RuntimeEnvironmentBuilder.java:160)
    at org.jbpm.runtime.manager.impl.RuntimeEnvironmentBuilder.newDefaultBuilder(RuntimeEnvironmentBuilder.java:390)
    at org.jbpm.examples.util.RewardsApplicationScopedProducer.produceEnvironment(RewardsApplicationScopedProducer.java:58)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_21]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21]
    at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
    at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
    at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
    at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:164)
    at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:137)
    at org.jboss.weld.bean.ProducerMethod$ProducerMethodProducer.produce(ProducerMethod.java:136)
    at org.jboss.weld.bean.AbstractProducerBean$AbstractProducer.produce(AbstractProducerBean.java:319)
    at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:307)
    at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:68)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:626)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:653)
    at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:108)
    at org.jbpm.runtime.manager.impl.cdi.RuntimeManagerProducer.newSingletonRuntimeManager(RuntimeManagerProducer.java:66)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) [rt.jar:1.7.0_21]
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) [rt.jar:1.7.0_21]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) [rt.jar:1.7.0_21]
    at java.lang.reflect.Method.invoke(Method.java:601) [rt.jar:1.7.0_21]
    at org.jboss.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:267)
    at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)
    at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)
    at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:263)
    at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:164)
    at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstance(MethodInjectionPoint.java:137)
    at org.jboss.weld.bean.ProducerMethod$ProducerMethodProducer.produce(ProducerMethod.java:136)
    at org.jboss.weld.bean.AbstractProducerBean$AbstractProducer.produce(AbstractProducerBean.java:319)
    at org.jboss.weld.bean.AbstractProducerBean.create(AbstractProducerBean.java:307)
    at org.jboss.weld.context.unbound.DependentContextImpl.get(DependentContextImpl.java:68)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:626)
    at org.jboss.weld.manager.BeanManagerImpl.getReference(BeanManagerImpl.java:692)
    at org.jboss.weld.injection.FieldInjectionPoint.inject(FieldInjectionPoint.java:136)
    at org.jboss.weld.util.Beans.injectBoundFields(Beans.java:796)
    at org.jboss.weld.util.Beans.injectFieldsAndInitializers(Beans.java:805)
    at org.jboss.weld.bean.SessionBean$SessionBeanInjectionTarget$1.proceed(SessionBean.java:179)
    at org.jboss.weld.injection.InjectionContextImpl.run(InjectionContextImpl.java:48)
    at org.jboss.weld.bean.SessionBean$SessionBeanInjectionTarget.inject(SessionBean.java:176)
    at org.jboss.as.weld.injection.WeldEEInjection.inject(WeldEEInjection.java:78)
    at org.jboss.as.weld.injection.WeldInjectionInterceptor.processInvocation(WeldInjectionInterceptor.java:54)
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ee.component.ManagedReferenceFieldInjectionInterceptorFactory$ManagedReferenceFieldInjectionInterceptor.processInvocation(ManagedReferenceFieldInjectionInterceptorFactory.java:109) [jboss-as-ee-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ee.component.ComponentInstantiatorInterceptor.processInvocation(ComponentInstantiatorInterceptor.java:76) [jboss-as-ee-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.WeavedInterceptor.processInvocation(WeavedInterceptor.java:53) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.weld.ejb.Jsr299BindingsCreateInterceptor.processInvocation(Jsr299BindingsCreateInterceptor.java:92)
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ee.component.NamespaceContextInterceptor.processInvocation(NamespaceContextInterceptor.java:50) [jboss-as-ee-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    at org.jboss.invocation.InterceptorContext.proceed(InterceptorContext.java:288) [jboss-invocation-1.1.2.Final-redhat-1.jar:1.1.2.Final-redhat-1]
    at org.jboss.as.ejb3.tx.EjbBMTInterceptor.handleInvocation(EjbBMTInterceptor.java:104) [jboss-as-ejb3-7.4.0.Final-redhat-19.jar:7.4.0.Final-redhat-19]
    … 20 more

    Reply
  12. Hammami Manel

    HELP!!
    Hi I tried follow this example my ProcessBean worked and the process started but i had a problem invoking TaskBean because of the TaskService injection : i think the @ Inject on TaskService doesn’t work and i’have got the problem:

    EJB Invocation failed on component TaskBean for method public java.util.List org.jbpm.examples.ejb.TaskBean.retrieveTaskList(java.lang.String) throws java.lang.Exception: javax.ejb.EJBException: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
    …..
    Caused by: java.lang.IllegalStateException: JBAS011048: Failed to construct component instance
    ……
    Caused by: java.lang.IllegalArgumentException: JBAS016069: Error injecting persistence unit into CDI managed bean. Can’t find a persistence unit named org.jbpm.domain in deployment rewards-basic.war

    Help i urgently need that for my final study project

    Reply
    1. jsvitak Post author

      Hello Hammami,
      have you tried to rename your persistence unit to org.jbpm.domain? I believe that in this version of libraries you have to stick to name org.jbpm.domain.

      Hope that helps,
      Jiri

      Reply
      1. manelhammami

        I don’t have the error anymore but now I have:
        14:44:05,039 WARN [org.jbpm.kie.services.cdi.producer.HumanTaskServiceProducer] (http-localhost-127.0.0.1-8080-2) Cannot get value of of instance @Default Instance due to WELD-001308 Unable to resolve any beans for Types: [interface org.kie.api.task.UserGroupCallback]; Bindings: [@javax.enterprise.inject.Default()]
        14:44:05,054 WARN [org.jbpm.kie.services.cdi.producer.HumanTaskServiceProducer] (http-localhost-127.0.0.1-8080-2) Cannot get value of of instance @Default Instance due to WELD-001308 Unable to resolve any beans for Types: [interface org.kie.internal.task.api.UserInfo]; Bindings: [@javax.enterprise.inject.Default()]
        14:44:05,125 INFO [stdout] (http-localhost-127.0.0.1-8080-2) retrieveTaskList by john
        14:44:05,133
        ERROR [org.jboss.ejb3.invocation] (http-localhost-127.0.0.1-8080-2) JBAS014134: EJB Invocation failed on component TaskBean for method public java.util.List org.jbpm.examples.ejb.TaskBean.retrieveTaskList(java.lang.String) throws java.lang.Exception: javax.ejb.EJBException: Unexpected Error
        ………
        Caused by: java.lang.NoSuchMethodError: org.kie.api.task.model.TaskSummary.getId()

  13. girish

    Hi,

    How do I clone Rewards-basic web application into my jbpm suite.
    I want to run this example through my JBPM suite not from eclipse.
    I have downloaded rewards-basic example which is on my local file system and I want to import this into JBPM suite.

    Please help me to do this.

    Regards,
    Girish

    Reply
    1. jsvitak Post author

      Hi Girish,
      There is no way to import rewards-basic web application into jbpm suite. It is a standalone web application. However you can clone jbpm-6-examples-assets repository to jbpm suite and use ‘rewards’ kie project in jbpm suite to work with the rewards process model.

      Hope that helps,
      Jiri

      Reply
  14. Pingback: Upgrade of jbpm-6-examples to jBPM 6.2 services | Jiri Svitak

  15. Emil

    Hi Jiri

    I’m trying to to your example application basic rewards on Wildfly server and I’m reciving errors:

    JBAS011875: Resource lookup for injection failed: env/org.jbpm.services.ejb.impl.RuntimeDataServiceEJBImpl/commandService

    Caused by: javax.naming.NameNotFoundException: UserTransaction [Root exception is java.lang.IllegalStateException: JBAS014237: Only session and message-driven beans with bean-managed transaction demarcation are allowed to access UserTransaction])

    I think problem is associated with some libraries but I’m not sure where exactly. Do you know maybe this problem ?

    regards

    Emil

    Reply
    1. jsvitak Post author

      Hello Emil,
      You can find more information related to this issue in JBPM-4590 and in linked discussions.
      This issue seems to be specific to Wildfly 8.2 and should be fixed in future releases of jbpm. In the meantime there is a workaround for Wildfly described here.

      Hope that helps,
      Jiri

      Reply
  16. wesley gibbsWes Gibbs

    I want to have a link called Create on a webpage, when the end-user clicks this Create link it creates an empty/blank jBPM business process using Java? I would have a form asking for the business process details, it’s name and other needed details.

    After it’s created it would just redirect to another webpage where the business process editor is embedded within an iframe. I’ve already figured out how to embed the business process editor on a webpage for an existing business process that I created via the KIE Workbench. Any help/direction is greatly appreciated.

    Reply
    1. wesley gibbsWes Gibbs

      My question is if you have an example of how to create a business process using Java? The KIE workbench “business process” editor that will be embedded on another webapge in an iframe is where the end-user will be redirected too to modify the blank business process.

      Reply
      1. jsvitak Post author

        I am not sure I understand your question. I think these are actually two questions.
        1.) To create a process model using Java, open jBPM documentation and look for “Process fluent API”. That is how you can create a process definition using pure Java.
        2.) I do not get the second question. The general answer is (as far as I remember) that you should be able to reuse KIE workbench business process editor and potentially embed it in your own application.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s