1 Reply Latest reply on Oct 29, 2015 8:02 PM by James Livingston

    How to make sure application starts after the management interface

    Eduard Korenschi Newbie

      So, we have this very simple app (Reduced to simple), where we do the initialization in a @PostConstruct method of a @Startup @Singleton EJB bean.

      The code is very simple, but it tries to read some resources throught the management interface


      public class StartupBean {
        public void run() {
        try {
        final ModelNode addr = new ModelNode().add("subsystem", "security");
        final ModelNode mn = Operations.createReadResourceOperation(addr, true);
        final ModelControllerClient client = ModelControllerClient.Factory.create(InetAddress.getByName(""), 9990);
        final ModelNode response;
        response = client.execute(mn);
        } catch (IOException e) {

      The problem is that if I just deploy (that is, if wildfly is already started), everything works as expected, but if I restart widfly, I receive

          "outcome" : "failed",
          "failure-description" : "WFLYCTL0379: System boot is in process; execution of remote management operations is not currently available"

      and immediately after,


      10:05:38,873 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0060: Http management interface listening on

      10:05:38,874 INFO  [org.jboss.as] (Controller Boot Thread) WFLYSRV0051: Admin console listening on


      Is there any way to configure my application to start after the management interface has been started?

        • 1. Re: How to make sure application starts after the management interface
          James Livingston Apprentice

          You *really* shouldn't do that, there is a fairly major risk that you will cause a server deadlock.


          If you perform a management operation, it could be queued behind any in-progress operations, such as performing a deployment. This means that JBoss may be waiting until the deployment finished, and hence waiting for your @PostConstruct method to complete. If you perform a blocking management operation from such a method, you will then make it wait until the operation completes and it can deadlock. In short, it is not safe to use management API from within any container-managed thread.



          What precisely are you doing with the data it returns, and does the EJB absolutely require that information in the @PostConstruct method? You two options are to make it non-blocking (for example start a thread which runs the operation, and not make the method wait for completion) or get the data you need another way.