Tuesday, November 27, 2012

jBPM 5.4 released !

We are proud to announce the release of jBPM 5.4.0.Final.  

The bits were ready more than a week ago already (and looking at the download statistics quite a few of you already found them ;)), but a busy travel schedule made it difficult to complete the work and announce everything.  But here it is !

Downloads:
Documentation:

The jBPM installer is probably the best way to get started.  Download the full installer and follow the documentation here to walk through some of the most important components.

So what's new?
Simulation

We've added simulation capabilities to the web-based process designer, that allows you to simulate how a process might behave at runtime.  This includes the addition of various simulation-related properties (like resources and duration-related attributes for tasks, and probabilities for diverging gateways etc.).  Our implementation is based on the specification created by the BPSWG (Business Process Simulation Working Group).

Based on these properties, you can run a number of instances of your process and:
  • Use the path finder to look at all identified paths
  • Look at the generated charts containing information about minimal, maximum and average completion times, etc. using (horizontal and vertical barcharts, pie charts or tables.
  • Check the timeline to get an overview of all the recorded events
Maciej did a blog recently on the ideas and concepts behind it, and Tihomir did a blog, including a 12-minute video, that shows simulation in action.



Local task service

When human actors participate in a business process (also known as human workflow), a task service is used to manage the life cycle of the tasks (claiming, completing, task lists, etc.).  While we supported the use of a centralized task service (using HornetQ for remoting), we now also support a local version that runs as a simple Java component next to the engine and all the work it does is synchronous and nicely integrated with the transaction of the process engine.

org.jbpm.task.service.TaskService taskService = 
    new org.jbpm.task.service.TaskService(
        emf, SystemEventListenerFactory.getSystemEventListener());
LocalTaskService localTaskService = new LocalTaskService(taskService);
LocalHTWorkItemHandler humanTaskHandler = new LocalHTWorkItemHandler(
    localTaskService, ksession, OnErrorAction.RETHROW);
humanTaskHandler.connect();
ksession.getWorkItemManager().registerWorkItemHandler(
    "Human Task", humanTaskHandler);

Spring 

We have improved our Spring support, where you can use a Spring configuration file to configure your environment and inject a ksession and/or task service into your application code.  For transactions, it integrates with the Spring transaction manager, supporting both JTA and RESOURCE_LOCAL with shared entity manager factory (emf) or shared entity manager (em).

JPA2

jBPM runtime persistence can now also use JPA2 for persistence.  That means it is completely independent of the underlying persistence provider (we use Hibernate by default but other persistence providers should be possible as well).  You can use Hibernate4 with JPA2 for even better performance.  For all the details on how to do this, here's a link to a persistence configuration file for both JPA1 and JPA2.

Some of the other features
  • Improvements on some of the BPMN 2.0 constructs in the core engine, related to error events, terminating end events in sub processes,
     
  • Introduction of a business calendar related to timers etc.
  • The ability to start a process by name, which will automatically start the latest version of that process.
  • We created separate wars for EE6 (AS7) and EE5 (AS5) to avoid a lot of manual dependency management.  JBoss AS 7.1.1 is now the new default application server in the installer.
  • Improved support for invoking web services from inside your processes.
  • A database-backed solution for managing which users are part of which group (UserGroupCallback).
  • When configuring handlers for domain-specific services, the ksession is automatically injected as an optional constructor parameter in the handler configuration file.
The details on all fixed issues and new features can be found in detail in JIRA.
jBPM 5.4.0.Final has been released in sync with the latest Drools 5.5.0.Final release.

If you have any questions / issues, let us know:
The jBPM team

27 comments:

  1. Hi Kris,

    This is Sumeru, I'm pretty new to jBPM. I've been involved in POC project in which the customer wants to drive the jBPM flow from there custom built web app in remote fashion. I've been exploring the jBPM 5.4 ReST APIs for sometime now and i've also found the exhaustive listing from the "resources" url on GWT-Console-Server. Now problems are,
    1. The listing doesn't explicitly say what does a particular API do, some were pretty intuitive to me but again some were not. Is there a documentation which says what APIs are for what function.
    2. Our customer wants to have a functionality of searching jBPM instances based on some business value. Say I've got a Order processing system and each order creates an instance. Each order has a business data captured, say Customer Name held in some variable (custName). Now what we need is find all instances for which the custName="abc" (say). I could find that i can pull all instances for a Process id and also extract dataset for an instance but could not find a ReST api which can search Order instances for a particular customer only.

    Please help with your valuable suggestion

    ReplyDelete
  2. 1. At this point, we don't have any additional documentation unfortunately, which parts are unclear?
    2. This information is stored in the history log, I would suggest creating your own custom database queries to find more complex information like this.

    ReplyDelete
  3. Hi Kris,

    Thanks for your reply. According to current area of work, following ReST urls are not clear to me.

    1. /gwt-console-server/rs/process/instance/{id}/state/{next}
    2. /gwt-console-server/rs/process/instance/{id}/end/{result}
    3. /gwt-console-server/rs/process/tokens/{id}/transition
    4. /gwt-console-server/rs/process/tokens/{id}/transition/default
    5. /gwt-console-server/rs/identity/sid/invalidate
    6. /gwt-console-server/rs/identity/sid
    7. t-console-server/rs/identity/secure/sid

    Also i'm facing one issue with the user credentials with which we're invoking ReST urls. Many of the urls can be invoked using credentials like admin/ admin. But urls like task-complete needs authentication to be done with the the particular user's credentials. Now it's not desired to store the user passwords in data. How to solve this problem?

    Another issue was while using DBUserGroupCallbackImpl, i could successfully configure this handler with my custom tables but while creating tasks i got the below exception

    "Error when creating task on task server for work item id 42. Error reported by task server: There are no known Business Administrators, task cannot be created according to WS-HT specification: org.jbpm.task.service.CannotAddTaskException: There are no known Business Administrators, task cannot be created according to WS-HT specification"

    Please help on this.

    Thanks
    Sumeru
    ---

    ReplyDelete
  4. Hi Kris,

    In regard to the "CannotAddTaskException", i forgot to mention that i had one user in my custom user table with user_id = 'admin'. I know that there should be one administrator user configured but probably the way i did it was not right. Does my custom Roles table need to have a row with role as 'Administrator' and the custom user-group association table should have one row which connects my 'admin' user with the 'Administrator' role so that the user.role.query returns a role like 'Administrator'? Not sure - need your help.


    Thanks
    Sumeru
    ---

    ReplyDelete
    Replies
    1. Hi, I'm also using DBUserGroupCallbackImpl and got the same error "CannotAddTaskException .. There are no known Business Administrators"
      Tried to add Administrator user and Administrator groups but still not working.

      Any suggestion ?

      Delete
    2. You should have the user "Administrator", as that one is always added by default (and all the other users / groups you're adding yourself of course).

      Delete
    3. Thanks, Kris for the reply. I figured it out how configure the user - it was pretty simple.

      @Gio - In the "User" table (or the name of the similar table where you have the user base) have a user with id = "Adminitrator".

      @Kris - please help me on the below issue
      Also i'm facing one issue with the user credentials with which we're invoking ReST urls. Many of the urls can be invoked using credentials like admin/ admin. But urls like task-complete needs authentication to be done with the the particular user's credentials. Now it's not desired to store the user passwords in data. How to solve this problem?

      Thanks
      Sumeru
      ---

      Delete
  5. @sumer, we simply use JAAS authentication. If you use the jbpm-installer, by default this is configured using simple properties files. But you can configure JBoss AS to use one of the other mechanisms as well, like using LDAP, database, etc. so you don't need to store passwords like this.

    ReplyDelete
    Replies
    1. Hi Kris,

      Thanks for the reply. But I'm not sure if i understood your reply correctly :( - May be u r refering to authentication for the jbpm-console which can be configured to used any standard auth method instead of properties file based auth. I'm not sure if I could explain my problem earlier properly ... so let me state once again ...

      Before making a ReST call, i'm calling "/j_security_check" ReST url with userid & password as form parameters. For ReST APIs like "/form/process/{0}/complete", i can use userid ="admin" & password="admin" (i mean a generic user credentials) but when i need to call "/form/task/{0}/complete", i need to pass the specific user's user id & password to whom this task is assigned, say if it's assigned to me then i need to pass userid="sumeru" & password="somepasswd". Now for the time being for POC sake, i have stored password in a properties file and my program is reading it classpath to do the j_securitycheck. But in actual this ReST call has to be made from a Web Application deployed on jboss and it is using LDAP authentication. Now when the user (to whom task is assigned) logs in takes some action on the screen and my program invokes the ReST call from the servlet. How do make the j_securitycheck to use the same userid/password that the user had input on the login screen for authentication? Is there any SSO option or any other custom way u can suggest?

      Please suggest.

      Thanks
      Sumeru
      ---

      Delete
    2. Sumer,

      Yes, I would recommend that you configure your application to use the same security domain as the jbpm-console-server and use sso, so that users don't have to log in twice.

      Kris

      Delete
    3. This comment has been removed by the author.

      Delete
  6. Hi Kris,

    i believe the full installer needs a small update. The download URL for eclipse helios is not valid anymore, the version was apparently moved to archive.

    ReplyDelete
  7. Hi Kris,

    Can you please tell me what's the purpose for following 4 ReST URLS. I know u r busy and i'm bothering u too much, may be one liners for each

    /gwt-console-server/rs/process/tokens/{id}/transition
    /gwt-console-server/rs/process/tokens/{id}/transition/default
    /gwt-console-server/rs/identity/sid
    /gwt-console-server/rs/identity/secure/sid

    Thanks
    Sumer

    ReplyDelete
  8. Hi Kris,

    I'm trying to register a new WorkItemHandler for calling java method. For this I've created a new WorkDefinition like below

    [
    "name" : "CallJava",
    "parameters" : [
    "Interface" : new StringDataType(),
    "Operation" : new StringDataType(),
    "ParameterType" : new StringDataType(),
    "Parameter" : new ObjectDataType()
    ],
    "results" : [
    "Result" : new ObjectDataType("java.util.Map")
    ],
    "displayName" : "CallJava",
    "icon" : "http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/java-icon/binary" ,
    "defaultHandler" : "com.sample.service.ExtendedServiceTaskHandler"
    ]

    I added the WorkItemHandler in the "CustomWorkItemHandlers.conf" in jbpm-gwt-console-server.war -> WEB-INF\classes\META-INF\

    [
    "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),
    "CallJava": new com.sample.service.ExtendedServiceTaskHandler()
    ]

    But while the gwt-console-server is trying register the WorkItemHandler (this implementing the interface org.drools.runtime.process.WorkItemHandler), i'm getting below exception, can you please help

    20:29:41,562 WARN [com.arjuna.ats.jta] (http-localhost-127.0.0.1-8080-6) ARJUNA016029: SynchronizationImple.afterCompletion - failed for org.drools.persistence.jta.JtaTransactionSynchronizationAdapter@a758c6f with exception: java.lang.ClassCastException: com.sample.service.ExtendedServiceTaskHandler cannot be cast to org.drools.runtime.process.WorkItemHandler
    at org.drools.common.AbstractWorkingMemory.getWorkItemManager(AbstractWorkingMemory.java:1127) [drools-core-5.5.0.Final.jar:5.5.0.Final]
    at org.drools.impl.StatefulKnowledgeSessionImpl.getWorkItemManager(StatefulKnowledgeSessionImpl.java:311) [drools-core-5.5.0.Final.jar:5.5.0.Final]
    at org.drools.persistence.SingleSessionCommandService$SynchronizationImpl.afterCompletion(SingleSessionCommandService.java:463) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
    at org.drools.persistence.jta.JtaTransactionSynchronizationAdapter.afterCompletion(JtaTransactionSynchronizationAdapter.java:22) [drools-persistence-jpa-5.5.0.Final.jar:5.5.0.Final]
    ...


    Thanks
    Sumeru
    ---

    ReplyDelete
  9. In general, when it's complaining about a class not implementing an interface (while in the code it clearly does), it typically means there are two versions of the same class in your classpath somehow. Could you check if you for example have multiple knowledge-api jars in your classpath?

    ReplyDelete
    Replies
    1. Hi Kris,

      Thanks for your reply, yes u r right, actually the Knowledge API was getting loaded by 2 ClassLoader and thus the exception. I got it resolved today, now my custom handler is working ok.

      But my remaining problem is that i'm not being pass on an complex object as parameter into the handler.

      Please find my WID below ... i'm trying to send the Student object instantiated in the BPMN flow into the handler as parameter. But it seems that i'm not being able get the Student object while within the handler. Or rather the parameter called "Parameter" is not getting set properly within workitem-parameter map

      [
      "name" : "CallJava",
      "parameters" : [
      "Interface" : new StringDataType(),
      "Operation" : new StringDataType(),
      "ParameterType" : new StringDataType(),
      "Parameter" : new ObjectDataType("com.sample.service.Student")
      ],
      "results" : [
      "Result" : new ObjectDataType("java.util.Map")
      ],
      "displayName" : "CallJava",
      "icon" : "http://localhost:8080/drools-guvnor/rest/packages/defaultPackage/assets/java-icon/binary" ,
      "defaultHandler" : "com.sample.service.ExtendedServiceTaskHandler"
      ]

      Can you help with ur suggestion?

      Thanks
      Sumeru
      ---

      Delete
    2. Hi,

      How do you try to populate the Parameter property? In general, you probably want to have a process variable that contains the Student object and then use a parameter mapping on your task to map that variable to the parameter "Parameter".

      Kris

      Delete
    3. Thanks for your reply. I have tried out the parameter mapping option, I've a process variable called "insStudentObj" of type Student and in the "Data Input Assignments" (DIA) for the "CallJava" task, i put it like "insStudentObj" (selected in From Object column) [Mapped to] "Parameter" (selected in the To Object column). When the WorkItem Handler was executed, the WorkItem parameter map didn't even have an entry for "Parameter". Next I tried to reverse it in the DIA as "Parameter" (selected in From Object column) [Mapped to] "insStudentObj" (selected in the To Object column) ... this time the flow couldn't be compiled, the log said invalid reference "Parameter".

      The last thing which succeeded was having kcontext.setVariable("insStudentObj", insStudentObj) done in a preceeding Script Task and then in the DIA i said "Parameter" (selected in From Object column) [Equal to] "#{insStudentObj}" (given in the value column). Since #{} expression always returns a String i overrode the Student.toString() to return a JSON structure for the student instance. I'm rebuilding the Student object from the JSON in the custom WorkItemHandler before calling the actual java service method.

      In short, i couldn't send the object instance of the process variable "insStudentObj" as-is into the handler. I don't know if it was something i did wrong if it's a JBPM bug.

      Thanks
      Sumeru
      ---

      Delete
  10. Sumer,

    if you use a variable mapping, you should indeed make sure that the variable actually contains the object (for example using the kcontext.setVariable(..), or by passing it in when starting the process, etc.). Combining this with the first version of the data input you described should do the trick.

    Kris

    ReplyDelete
    Replies
    1. Hi Kris,

      That was spot on, it worked ... i could send out Object into the handler.

      Recently i started working on jboss brms which comes with jBPM 5.3 and i'm trying register the "org.jbpm.bpmn2.handler.ReceiveTaskHandler" in the CustomWorkItemHandlers.conf. But unfortunately ReceiveTaskHandler takes ksession as constructor parameter and it doesn't have a default constructor. My CustomeWorkItemHandlers.conf looks like below

      [
      "Log": new org.jbpm.process.instance.impl.demo.SystemOutWorkItemHandler(),
      "MyTask": new org.jbpm.handlers.TestworkItemHandler(),
      "Receive Task": new org.jbpm.bpmn2.handler.ReceiveTaskHandler(ksession),
      "Send Task": new org.jbpm.bpmn2.handler.SendTaskHandler(),
      ]

      it's not being able to load the handlers and it's throwing multiple exceptions in the log as below ...

      17:09:36,640 WARN [com.arjuna.ats.jta] (http-/127.0.0.1:8080-6) ARJUNA016029: SynchronizationImple.afterCompletion - failed for org.drools.persistence.jta.JtaTransactionSynchronizationAdapter@133e2b3 with exception: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
      at java.lang.String.substring(String.java:1937) [rt.jar:1.6.0_30]
      at java.lang.String.substring(String.java:1904) [rt.jar:1.6.0_30]
      at org.mvel2.util.ErrorUtil.rewriteIfNeeded(ErrorUtil.java:12) [mvel2-2.1.3.Final.jar:]
      at org.mvel2.MVELInterpretedRuntime.parseAndExecuteInterpreted(MVELInterpretedRuntime.java:167) [mvel2-2.1.3.Final.jar:]
      at org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:49) [mvel2-2.1.3.Final.jar:]
      at org.mvel2.MVEL.eval(MVEL.java:150) [mvel2-2.1.3.Final.jar:]
      at org.mvel2.ast.InlineCollectionNode.execGraph(InlineCollectionNode.java:180) [mvel2-2.1.3.Final.jar:]
      at org.mvel2.ast.InlineCollectionNode.execGraph(InlineCollectionNode.java:138) [mvel2-2.1.3.Final.jar:]
      at org.mvel2.ast.InlineCollectionNode.getReducedValue(InlineCollectionNode.java:105) [mvel2-2.1.3.Final.jar:]
      at org.mvel2.MVELInterpretedRuntime.parseAndExecuteInterpreted(MVELInterpretedRuntime.java:106) [mvel2-2.1.3.Final.jar:]
      at org.mvel2.MVELInterpretedRuntime.parse(MVELInterpretedRuntime.java:49) [mvel2-2.1.3.Final.jar:]
      at org.mvel2.MVEL.eval(MVEL.java:165) [mvel2-2.1.3.Final.jar:]
      at org.drools.SessionConfiguration.loadWorkItemHandlers(SessionConfiguration.java:311) [drools-core-5.3.1.BRMS.jar:5.3.1.BRMS]

      Delete
  11. Hi Kris,

    Is there Business Calendar (BC) functionality in jBPM 5.3 or higher. Only documentation i find for jBPM BC is for version 3.2. If yes, can you please suggest how to go about?

    Thanks
    Sumeru
    ---

    ReplyDelete
    Replies
    1. Yes, in jBPM 5.4 or higher:
      https://issues.jboss.org/browse/JBPM-3600

      Kris

      Delete
  12. HI Kris,

    Can you help me how to install in Windows 8 i have been trying from last 2 weeks with different databases and everything was futile

    Please help me

    ReplyDelete
  13. Rajesh,

    Could you open up a jBPM JIRA issue and attach all the information you can regarding the issue(s) you're encountering? Unfortunately, with the information you're giving here, I can't be of much help.

    Kris

    ReplyDelete
  14. Hi Kris,

    I have been struggling with the email notifications in human task.

    1. When a task is created, I want to send an automated email notification to the user. I don’t want to do it from my java code and wanted to use the human task to accomplish this.

    2. From the documentation I understood that I can use the task’s notifications property to configure this.

    a. If I want to send notification immediately is there any other way to do this instead of Type (I.e. not-started) + expires At (I.e. 1m) combination? As I read in V3 documentation “notify= true” property.

    b. Notifications takes the ‘user’ as input for the FROM and TO columns instead of email address. This brings me to my next questions how to map USER/organizationalentity with email address. Please advice how to accomplish this with mySql instead of property files.

    Thank you.
    Raj

    ReplyDelete
  15. Hi Kris ..I am learning JBPM and I want to integrate with ActiveMQ JMS at this initial level I want to call the main method written for message in java code of Active MQ in my Service Task of BPMN2 so that I could get and send message....And one more thing I want to integrate my jbpm with drools so that I could write all the rules for my jbpm in drools I had tried but the drl file has been activated in my jbpm. Please solve my problem and you can send me on my mail saurav.srivastav1@gmail.com

    ReplyDelete
  16. Hello Kris,

    We deployed JBPM 5.4. on Jboss 5.1.GA and the "jbpm-console" with "jbpm-server" works fine. We can start/stop our process, so it ist Ok, till we use the "Eclipse JBPM-Designer".
    We have problem with Web-JBPM-Designer because of Guvnor 5.5.0.Final, which comes with the installer.

    Configuration from "build.properties":
    "drools.guvnor.version=5.5.0.Final
    drools.guvnor.url=https://repository.jboss.org/nexus/content/groups/public-jboss/org/drools/guvnor-distribution-wars/5.5.0.Final/guvnor-distribution-wars-5.5.0.Final-jboss-eap-5.1.war"

    First of all: Guvnor from the installer FOR JBOSS comes with "jetty-env.xml". We configured it for jboss, this is not a problem.
    The Problem is, that Guvnor 5.5.0 Final use Servlet 3.0 and Jboss 5.1.GA is running on Servlet 2.5. As workaround we changed our configuration so, that the Servlet 2.5 of Jboss is used by deployment of Guvnor 5.5.0, but then we become GUI Exceptions by starting of Web-JBPM-designer...

    Did you test Guvnor 5.5.0.Final with jboss 5.1? What is the solution in our case? Should we use Guvnor 5.4.0? In this Case the Installer should be edited and by Jboss 5.1 should be used another version of Guvnor.

    Thank you for your good job Kris!

    Best regards,
    Serghei Mazurean
    Email:s.mazurean@cenit.de

    ReplyDelete