It is possible to embed Bonita 4.0.1 on web applications just line it can be done on desktop ones. The basic steps are the same. Here I will describe how to do the deployment on Tomcat 6.0.18:
- Add the Bonita libraries in bonita-runtime-4.0.1/lib/server to the application's classpath, except for the
servlet-api-2.3.jarlibrary, since this one will conflict with Tomcat's own servlet library. In the case of applications deployed as WAR files in Tomcat, they must be located in the WEB-INF/lib folder. - Add the
environment.xml,environment-history.xml,hibernate.properties,hibernate-core.propertiesandhibernate-history.propertiesfiles to the application's classpath. In WAR packages this can be done by adding the files to the WEB-INF/classes folder. - Add the JAR files with your database driver's to Tomcat's lib folder.
- Configure your web application to use JAAS security with a login module of your choice. Detailed instructions on how to do that in Tomcat 6.0 are available here.
- Modify your JAAS configuration to include the login module required by the Bonita Engine:
org.ow2.novabpm.identity.auth.StorageLoginModule. It must be flagged as required and it must be the last in the chain of login modules you have configured for your application. No one of the login modules configured must be flagged as sufficient. If you do so and one of the login modules succeed, the control will return to the application before actually running Bonita's module. This will make the Bonita engine to raise a security exception. - Add the system property
org.ow2.bonita.api-typewithStandardvalue to the JAVA_OPTS environment variable. This can be done editing thecatalina.batfile found in the bin folder of the Tomcat distribution. - Compile and deploy your application.
In general, Bonita is not affected if deployed embedded in a web application or in a desktop one, as long as the necessary resources are available in the classpath. The only limitation is imposed by the use of a system property to specify the API type (either EJB2, EJB3 or Standard) because it is system wide, meaning that you cannot have in the same Tomcat server an application with Bonita embedded and another with Bonita as a client to a server deployed somewhere else.

Hi Luis,
ReplyDeleteIt's an effective tutorial .
Thank you
alis
Hi,
ReplyDeletecan you explain how use examples provided with Bonita runtime (approval workflow, websale...) in both standard and entreprise environment please ?
It is not clear in Bonita doc
Bonita's user
fantastic tutorial !!!
ReplyDeleteHi mmalgare!
ReplyDeleteI am glad, you found it useful!
Thanks,
Luis!
Hi Luis,
ReplyDeletei've got a web app with bonita-server embedded.
it perfectly works.
now i'd like to reuse Bonita Console as GUI to manage workflow.
do you think it is possible to deploy the Bonita Console onto the same Tomcat? can this two user interfaces work toghether, sharing the same db?
do you have any idea?
thanks in advance
Antonio
Hi Antonio!
ReplyDeleteOne option (quick and dirty) is to configure the console to access the same database than your application. You need to make sure the Hibernate cache is disable (it is disable by default on Bonita 4.1)
It is possible to deploy the console in the same Tomcat that your application is using. However, you need to move a lot of stuff and I haven't done that. What I would do (assuming it is possible in your environment) is to deploy the application you created on the Tomcat part of the console.
Regards,
Luis!
Hi Luis,
ReplyDeletethank you very much!
all the best
Antonio
You are welcome!
ReplyDeleteRegards,
Luis!