JBoss have come up with an embeddable version of their EJB3 implementation. An alpha release is available for download.
I downloaded it and played around with the embedded example from the tutorial. Here's what I did:
- once you've downloaded and unzipped the alpha release (I tested with jboss-EJB-3.0_Embeddable_ALPHA_5.zip), 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 (see below for more on this).
- 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:
change them to:CustomerDAOLocal local = (CustomerDAOLocal) ctx.lookup(CustomerDAOLocal.class.getName()); CustomerDAORemote remote = (CustomerDAORemote) ctx.lookup(CustomerDAORemote.class.getName());CustomerDAOLocal local = (CustomerDAOLocal) ctx.lookup("CustomerDAOBean/local"); CustomerDAORemote remote = (CustomerDAORemote) ctx.lookup("CustomerDAOBean/remote"); - start jetty: java -jar start.jar and now you can test EJB3s in jetty by surfing to the demo: http://localhost:8080/standalone/EmbeddedEJB3.jsp
I don't think it should be necessary to move the jboss jars out of the webapp, but it makes sense if you want to use EJB3 with more than one webapp.
I haven't as yet been able to make it work with leaving the jars inside the webapp. I get a ClassNotFoundException:
Caused by: org.jboss.util.NestedRuntimeException:
Cannot load class org.jboss.mx.server.JBossMXServerConfig;
- nested throwable: (java.lang.ClassNotFoundException:
org.jboss.mx.server.JBossMXServerConfig)
at org.jboss.util.Classes.instantiate(Classes.java:514)
at org.jboss.mx.server.ServerConfig.getInstance(ServerConfig.java:74)
at javax.management.MBeanServerFactory.
Posted at 06:08AM Dec 05, 2006 by janb in General | Comments[3]
Posted by Hani Suleiman on December 05, 2006 at 08:17 AM EST #
As you're the second person in a week to mention pitchfork to me, I'll have to take the hint and check it out :-)
Note that we've done some work so that Jetty will also work with Easybeans (www.easybeans.org) - support for Jetty is in Easybeans svn trunk at the moment but is scheduled for the next milestone release. I'll blog about it a little later.
cheers
Jan
Posted by Jan Bartel on December 05, 2006 at 12:37 PM EST #
java.lang.ClassNotFoundException: org.jboss.mx.server.JBossMXServerConfig
Any pointers would be greatly appreciated!
Thanks!
Posted by Grant on April 06, 2007 at 03:01 PM EST #