Wednesday, April 8, 2009

Accessing a Bonita J EE deployment with the Console

The Bonita Console is configured to deploy and work with processes in an embedded instance of the BPM engine.

If you deployed the Bonita engine as a J EE application you will have to either develop your own administrative console from scratch, use the provided Ant tasks for management (described in the Bonita Cookbook, section 7.4) or reconfigure the console to access the remote engine instead of the embedded one.

The following steps show how to reconfigure the console to access a Bonita engine deployed in an application server:

  1. Set the API Type variable.
  2. Set the initial context properties.
  3. Include the client libraries.
  4. JAAS settings to propagate the client security identity.
  5. Changing the console's default port (optional)

I will further discuss each one of those steps in the following sections.

Set the API Type variable

For the Bonita classes in the console to work as a facade to an engine deployed in a remote server rather than as an embedded solution you need to set the API type variable (org.ow2.bonita.api-type) with either EJB2 or EJB3 values (depending on the EJB environment you are using).

The easiest way to do it is by editing the bpm.bat or bpm.sh file (in the bonita-console-4.1/bin folder). There you can change the value of the BONITA_OPTS variable from -Dorg.ow2.bonita.environment=bonita-environment.xml to -Dorg.ow2.bonita.api-type=EJB2 or -Dorg.ow2.bonita.api-type=EJB3. Since the org.ow2.bonita.environment variable is used only in the server side of the Bonita engine, it will not be necessary anymore and can be safely replaced with the settings for the API type variable.

Set the initial context properties

Since the Bonita Engine will be running in a different Java virtual machine than the Bonita Console, the latter needs to know the network location of the former, even if it is in the same physical machine.

This is done by setting 2 standard JNDI properties: java.naming.factory.initial and java.naming.provider.url. The best way to provide the values for those variables is by editing the WEB-INF/conf/common/common-configuration.xml file, located in the bonita-console-4.1/webapps/portal.war application. At the beginning of that file, you will find commented XML elements that will set the properties with the values for each one of the environments supported by default (Jonas, JBoss and EasyBeans). You just need to uncomment the pair of properties for your environment and update the IP and port of Bonita Engine's location in the value of the java.naming.provider.url property. Steps 1 to 6, 9 and 10 of this post will give you detailed instructions on how to modify and rebuild the WAR file.

Include the client libraries

The Bonita Console will needed additional libraries with the code necessary to connect to the application server were the engine is deployed, that can be included in the classpath by adding them to the bonita-console-4.1/lib folder.

Those libraries need to be provided by your application server vendor. For example, for Jonas 5 you will have to include a client.jar file, for JBoss 4.0 you will have to include a file called jbossall-client.jar and for JBoss 5.0 you will have to provide several different JAR files. Most of the time those files are provided with the AS distribution.

Since Tomcat, Exo and the Bonita Console make use of some common libraries (like Log4J) you will need to check the libraries you are adding from your application server are not already provided in the bonita-console-4.1/lib folder or you will have classloading or API version issues. Ideally, you should keep the newer version of the library in case of conflicts.

JAAS settings to propagate the client security identity

For the Bonita Engine to know what user is currently logged in the Console, you will need change the Console's JAAS settings to include a login module that can propagate the client's security identity to the application server.

That login module needs to be included as the last module of the exo-domain section in the bonita-console-4.1/conf/jaas.conf file.

The actual login module to use depends on the application server that you are using. However, you can find sample settings for the environments supported out of the box in the bonita-runtime-4.1/conf/jaas-*.cfg files.

Changing the console's default port (optional)

If you are running the application server and the console in the same machine, make sure they are not using the same port to publish the web applications (for example, both Bonita Console and JBoss use 8080 as the default port). You can change the console's default port by editing the bonita-console-4.1/conf/server.xml file as described here.

15 comment(s):

  1. hi,

    if I understood right, can I put in Bonita jonas application server as EJB2 ... How do I put the console in Web 2.0 Jonas? Then how can I create applications that are based on in bonita jonas?

    thanks

    ReplyDelete
  2. Hello!

    I have not deployed the console (or that matter the eXo Platform) in an application server yet so I cannot really give you any advise on how to do that.

    What I have done is to deploy the Bonita engine in an application server and then connect to it from the console running on a separated virtual machine (with a standalone Tomcat).

    I will definitely consider to do that for future posts.

    Regards,
    Luis!

    ReplyDelete
  3. Hello !

    I need some details to understand more Bonita.

    1. What is the bonita.ear for ? Do i have to create a new one with Eclipse if i develop a new workflow ?
    2. Can we use the bonita console with jonas in order to administrate the workflow, as if i launch a bpm run ?
    How can i process ? Do i have to deploy with Jonas admin, all WARS (portal.war, web.war, exoplateform.war,...)
    3. How can i run the websale sample (Nova distribution) on jonas ? Do i have to recover the war associate ? Do i have to use Eclipse ? What must i do ?
    4. We have a great french bonita team. Is there some tutorials in french ?
    Thanks for your help !
    Thanks for your help ?

    ReplyDelete
  4. Hi!

    1. The bonita.ear file is a J EE application that contains the workflow engine itself and does not need to be modified to deploy any workflow.

    2. I have not deployed the Console itself in an application server. I will consider that for upcomming posts. You might get some help on that from the eXo platform team.

    3. I have not run the examples so I am not sure. I know you don't need Eclipse if you just want to use them, they are ready to deploy. You can get further details on how to run the examples from the Cookbook.

    4. I don't speak French.

    Regards,
    Luis!

    ReplyDelete
  5. Thanks for your answer Luis !

    I have an other question.
    I developped a workflow with Eclipse / Pro Ed and i deploy the .BAR in the bonita console.

    Now i want to deploy the workflow in a enterprise server (tomcat, jboss or jonas). What do i have to do ? Do i have to deploy a .BAR too ? I know that i have others things to do but the Cookbook is not very clear.
    Have you any idea ?
    Thanks

    ReplyDelete
  6. I have the similar abovementioned confusion how to deploy the workflow in enterprise server, too!

    I have draw the workflow and define hook, then what should i do for deploying it in webserver?

    ReplyDelete
  7. Hello!

    I think I will write a post about it.

    The more simple solution to deploy a process in both a Web and a J EE environment is to configure the console to use the same database than your application/deployed engine. That way you can use the console to deploy the process.

    Regards,
    Luis!

    ReplyDelete
  8. Hello !

    I followed each steps of that tuto. I use jonas 5 (port 9000).
    So if i want to launch the console, i have to run jonas server, start bpm, and open a explorer with the url "http://localhost:9000/portal". is that right ?
    When i start the bpm, i have some errors

    in the catalina logs :
    *attention : couldn't initialize jasper
    *grave : null component catalina:type=jspmonitor, name=jsp, webmodule=//localhost/exoresourcesbpm, j2eeapplication=none, j2eeserver=none

    in the localhost logs
    There are an execption load for each servlet of the webapp (/exoresources, /portal, /web, ...)
    maybe i forgot something but i don't know what.

    ReplyDelete
  9. Hello!

    First, can you please give yourself a name/nick? I don't know if I am talking to the same author of the other anonymous posts.

    Now, I don't really understand your error description. I don't really know what you are trying to do or how you are doing it.

    If you are running both Jonas and the Console (reconfigured as described in this post) in the same machine, some of your errors might be because of a port conflict. Try running 1 at the time or running them on different machines.

    You should post your question (with a detailed description) to the Bonita forums, since I haven't worked with Jonas (this and all posts have so far being tested with JBoss 4)

    Regards,
    Luis!

    ReplyDelete
  10. Hi Louis !
    Sorry for the name, i wrote the 4 last posts in "Anonymous".
    So i read your tuto and it can be the solution about what i want from the beginning.
    You wrote that if we want to deployed the bonita engine as a JEE application, 2 choice : develop our own administration or reconfigure the console. I chose the last one and that i'm trying to do : configure the console to run with jonas.
    My final purpose is to deploy my workflow on the server through the portal.
    I hope you'll understand me.

    Guess what ? I post a message on Bonita Forum (OW2) and they show me your tuto !

    Thanks a lot

    Laura !

    ReplyDelete
  11. Hi Laura!

    LOL. I guess those things happen.

    Did you try running the console and Jonas in different machines?

    Can you make sure there are not white spaces or special characters in your console's installation path?

    Regards,
    Luis!

    ReplyDelete
  12. Luis !

    Unfortunately i have just one machine. i took care of the path and that's ok ! Too bad that i can't do copy/paste ...! Apparently, logs says that it can't find the context.
    when i remove the client.jar (i took it from jonas ), the only error is : cannot create portal container.
    so so hard ....:-D...but i'll find !

    Laura

    ReplyDelete
  13. Hi!

    Well, it's no problem. You just need to make sure they are not using the same port (e.g: 8080 for Tomcat and 9000 for Jonas).

    Also, is the console working correctly when you don't make any changes to it?

    If you want, you can send me a screenshot or log of the error to my mail: luis (dot) sanabria (at) gmail (dot) com

    Regards,
    Luis!

    ReplyDelete
  14. Thank you It works fine for me.

    I just had some jar conflicts:

    I needed to replace the common-logging and log4j
    from the console by the one provided by the jboss client.

    Jboss 4.3.2

    Regards,
    Olivier

    ReplyDelete
  15. Hi Oliver!

    That's great!

    Thanks for the additional information!

    Regards,
    Luis!

    ReplyDelete