Jetty and JBoss EJB3
JBoss have released with an alpha version of an embeddable EJB3 implementation. It is available for download
Here are the steps required to get jboss-EJB-3.0_Embeddable_ALPHA_5 working with Jetty:
- make sure you're using jre 1.5
- download jboss-EJB-3.0_Embeddable_ALPHA_5.zip and unzip it
- go to the docs/embedded-tutorial/embedded-war directory and build it (just type ant).
- unjar the war file in docs/embedded-tutorial/embedded-war/build/standalone.war to your $jetty.home/webapps directory.
- move all of the jars in $jetty.home/webapps/standalone/WEB-INF/lib except for tutorial.jar to $jetty.home/lib/ext/jboss Note 1
- finally, edit the $jetty.home/webapps/standalone/EmbeddedEJB3.jsp file. The JNDI lookups for the beans in this file don't work and don't match the documentation, so you need to change them. Find the lines:
CustomerDAOLocal local = (CustomerDAOLocal)ctx.lookup(CustomerDAOLocal.class.getName());
CustomerDAORemote remote = (CustomerDAORemote)ctx.lookup(CustomerDAORemote.class.getName());
change them to:
CustomerDAOLocal local = (CustomerDAOLocal)ctx.lookup("CustomerDAOBean/local");
CustomerDAORemote remote = (CustomerDAORemote)ctx.lookup("CustomerDAOBean/remote");
- start jetty:
- surf to http://localhost:8080/standalone/EmbeddedEJB3.jsp to test EJB3s in Jetty with the JBoss supplied demo
Note 1: Besides being a good idea to move the jboss jars out of the webapp if you intend on using them with other webapps, it seems to be necessary (at least for now) to avoid a strange ClassNotFound exception.