As explained in the article How to use Bonita bundles in IntelliJ IDEA, it is a common practice, when developing an application, to embed the server in the integrated development environment. Here, we’ll see how to do this in Eclipse IDE.
First, download the BOS-Tomcat bundle from the BOS download page (from the Bundles tab) and unzip it. Name this BOS_INSTALL.Everything else will be done in Eclipse IDE. Download eclipse for JEE developers and launch it.
Create a new server (hit ctrl+N, and select Server in the server submenu).
In the form “define a new server,” select Apache->Tomcat V6.0 server.
On the next form, define BOS_INSTALL as the Tomcat installation directory.
And hit Finish.
In the server view, double click on BOS bundle server.
In the overview configuration, change the server location to tomcat installation
Save it.
In the servers view, if you start the tomcat (Ctrl+Alt+R) and point your browser to http://localhost:8080/bonita, you’ll get an error. Bonita can’t find its BONITA_HOME environment variable.
This means that Bonita can’t find the environment variables which are defined in the script bin/setenv.{sh|bat}.
Click Open the launch configuration on the BOS bundle general information.
In the arguments tab, click on Variables… (either button is OK).
Click on Edit Variables…
and create the following variables:
- CATALINA_HOME
- fill with the value of BOS_INSTALL
- BONITA_HOME
- -DBONITA_HOME=${CATALINA_HOME}\bonita
- CMIS_CONFIG
- -Dexo.data.dir=${CATALINA_HOME}/external/xcmis/ext-exo-data
- -Dorg.exoplatform.container.standalone.config=${CATALINA_HOME}/external/xcmis/ext-exo-conf/exo-configuration-hsql.xml
- LOG_OPTS
- -Djava.util.logging.config.file=${CATALINA_HOME}\external\logging\logging.properties
- MEMORY_OPTS
- -Xshare:auto -Xms512m -Xmx1024m -XX:MaxPermSize=256m -XX:+HeapDumpOnOutOfMemoryError
- SECURITY_OPTS
- -Djava.security.auth.login.config=${CATALINA_HOME}\external\security\jaas-standard.cfg
Validate and add to the VM arguments :
-Dfile.encoding=UTF-8 ${LOG_OPTS} ${SECURITY_OPTS} ${BONITA_HOME} ${MEMORY_OPTS} ${CMIS_CONFIG}
The configuration is now finished. Test it by creating a new dynamic web project.
Add a new jsp file, and name it listProcesses.jsp with the following content:
[cc lang=“Java”]
<%@ page language=“java” contentType=“text/html; charset=ISO-8859-1”
pageEncoding=“ISO-8859-1”%>
<%@ page import=“org.ow2.bonita.facade.QueryDefinitionAPI”%>
<%@ page import=“org.ow2.bonita.util.AccessorUtil” %>
<%@ page import=“org.ow2.bonita.light.LightProcessDefinition” %>
<%@ page import=“javax.security.auth.login.LoginContext” %>
<%@ page import=“org.ow2.bonita.util.SimpleCallbackHandler” %>
Deployed processes
- <%
LoginContext loginContext = new LoginContext("BonitaStore", new SimpleCallbackHandler("user", ""));
loginContext.login();
QueryDefinitionAPI queryDefinitionAPI = AccessorUtil.getQueryDefinitionAPI();
- "+lightProcessDefinition.getName()+" "); } loginContext.logout();
for (LightProcessDefinition lightProcessDefinition : queryDefinitionAPI.getLightProcesses()) {
out.println("
%>
[/cc]
And now, by starting the project (Alt+Shift+X R), you should see the list of processes deployed on the bundle.