0 Replies Latest reply on Aug 11, 2007 3:48 PM by Dan Allen

    embedding within a web application (jetty)

    Dan Allen Master

      I am attempting to bootstrap the embedded jboss from within a web application that is running under Jetty. I realize that it may seem a little silly to want to do, but hear me out. The holy grail of maven 2 development is using the embedded jetty container. This worked nicely under Seam 1.2.1 when the ejb standalone was being used, but now that the embedded jboss has been put in place, this no longer works.

      I have two environments, a test case and the servlet listener. Both of them execute the exact same code. When I run the test case, I can lookup objects in JNDI and everything works just great. On the other hand, when I use the servlet listener, I cannot find objects in JNDI. Here is the code:

      public class EmbeddedListener implements ServletContextListener {

      private Bootstrap bootstrap;

      private boolean started = false;

      public void contextInitialized(ServletContextEvent event) {
      try {
      URLStreamHandlerFactory factory = new URLStreamHandlerFactory();
      bootstrap = Bootstrap.getInstance();
      started = true;
      Hashtable<String, String> props = new Hashtable<String, String>();
      props.put("java.naming.factory.initial", "org.jboss.naming.JBossRemotingContextFactory");
      props.put("java.naming.factory.url.pkgs", "org.jboss.naming:org.jnp.interfaces");
      // This next line will fail
      System.out.println(new InitialContext(props).lookup("UserTransaction"));
      } catch (Exception e) {

      public void contextDestroyed(ServletContextEvent event) {
      if (started) {


      Is it going to be possible to run the Bootstrap from within a servlet context?