1 Reply Latest reply on Sep 13, 2011 8:48 AM by Aslak Knutsen

    Bind CommandRunner for Embedded Glassfish on start

    Magnus Smith Newbie

      I was thinking that it would be really useful if the Glassfish CommandRunner could be bound to jndi when the embedded container is started.


      Looks like it would just be a case of adding



      CommandRunner commandRunner = glassfish.getCommandRunner();

      new InitialContext().bind("org.glassfish.embeddable.CommandRunner", commandRunner);




      to the start method on the GlassfishContainer and then unbinding it on the stop method.


      Then in the test class we could use



      @Resource(mappedName = "org.glassfish.embeddable.CommandRunner")

      CommandRunner commandRunner



      This would open up all the glassfish admin commands from test classes.