Jetty and ObjectWeb EasyBeans (aka JOnAS EJB3 Container)
EasyBeans is an open-source Enterprise Java Beans (EJB) container hosted by the OW2 consortium. The License used by EasyBeans is the LGPL.
EasyBeans is a lightweight container that can be embedded in several Java EE servers or Web server like Jetty.
There are different packages on the EasyBeans download page. The Jetty package has to be downloaded. It is provided both in .zip or .tgz format
- A JRE v5.0 (or higher) is required
- Jetty 6.1 or higher version is needed (the previous versions don't have a feature required by EasyBeans)
- Ant tool (1.6 or higher)
Adding EasyBeans in Jetty
This step is quite easy. EasyBeans packaging provides a .war file. This .war file has to be copied in JETTY_HOME/webapps/ folder.
Using an existing example
The examples provided in the EasyBeans release need to be copied in the $JETTY_HOME/examples_ejb3s/ directory. The resulting directory will be $JETTY_HOME/examples_ejb3s with subfolders like statelessbean
Trying the example
The preview is bundled with some examples. The first one is a stateless bean
Here are the steps for launching this example:
- Check that JETTY_HOME environment variable is defined before launching ant scripts
ant needs to be launched in $JETTY_HOME/examples_ejb3s/statelessbean directory. This will compile the source code and copy the archive into the $JETTY_HOME/ejb3s/stateless.jar/ directory.
- On the server side, some traces will be printed. This is because the EJB3 container has detected a new module in the $JETTY_HOME/ejb3s directory. The bean was loaded automatically.
Creating container for archive /home/xxx/xxx/stateless.jar.
- Then, the client can be executed by running the command ant run.client
If the client is executed without errors, the output will be:
run.client: [java] Calling helloWorld method... [java] Add 1 + 2... [java] Sum = '3'.
- There is also a servlet's client that has been put in $JETTY_HOME/webapps directory.
It can be accessed with the default url: http://localhost:8080/stateless.war/
An online documentation about EasyBeans/Jetty is available on EasyBeans web site.