Take the “H2O” with you
There could be times that you need to access a message gateway, either for message transmission or for your software development needs. And it would be handy if it doesn't require any installation, but allows you to run on any machine, as long as JDK is available. This article will illustrates on how to prepare an "embedded" version of H2O, that runs on Jetty and HSQLDB, which you can bring it with you all the time.
PreparationThere are a couple of things we need to prepare before proceeding. First of all, let's create a folder which we will put everything together. Let's call it "/home/hermes2". Afterwards, you will need to have the webapp and plugin of H2O ready, you can either copy it from your installation or compile it from the sources. Download both Jetty and HSQLDB from their corresponding project website.
JettyLet's begins with the setting up of the application server. After you have downloaded Jetty from the project website, extract and copy the following files to the folder we defined above (/home/hermes2).
./etcNow, we need to restrict the access of the admin context path. Define the location of the properties file that store the username and password in /home/hermes2/etc/jetty.xml.
<Set name="UserRealms">Define the username and password in realm.properties
<Set name="name">Corvus Restricted Area</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
- Create the databases First of all, we need to create the 2 databases for ebMS and AS2. By defining the location and name of the database in the file "server.properties", the databases will be created by HSQLDB upon starting up.
- Setup SQLTool for SQL command execution After that, we need to create the table for each of the databases, we will use the SQLTool that comes along with HSQLDB in doing so. But before we can launch the application, we need to have some setting up, e.g. defining the username and password in accessing the databases. Create a file called sqltool.rc in user home directory and have the content illustrated as below.
- Create the tables for H2O
- Create user and grant access right
server.database.0=file:ebmsWe can then start the HSQLDB server by running the bash script,
java -jar hsqldb.jar ebms-sa ebms-hsql.sql
java jar hsqldb.jar as2-sa as2-hsql.sql
java -jar hsqldb.jar ebms-sa java -jar hsqldb.jar as2-sa
H2O DeploymentCopy the following folders to "/home/hermes2"
./pluginsModify the configuration files, basically to setup the path location and also the JDBC settings.
Time for testingOK, now everything is ready and we can start Jetty and test.
Another step further - In-process mode for HSQLDBBut we can make the execution more seamless by having HSQLDB running as in-process mode. So that we don't need to have it started up explicitly.
Change the db connection setting in the file ebms.module.xml, as2.module.core.xml, partnership.module.core.xml (Loopback) as follows, restart and that's it.
<parameter name="url" value="jdbc:hsqldb:file:/home/hermes2/hsqldb/data/ebms"/>And yet, there's one issue that you need to be aware. It is now tied to a particular path (/home/hermes2), you will need to change the path of the various config file accordingly if you want to run it in other location.
<parameter name="url" value="jdbc:hsqldb:file:/home/hermes2/hsqldb/data/as2"/>
Posted by Ronnie Kwok on 08/14 at 10:44 AM