Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-3865

java:jboss/exported is not available in @PreDestroy methods during shutdown

XMLWordPrintable

    • Icon: Feature Request Feature Request
    • Resolution: Won't Do
    • Icon: Major Major
    • None
    • 8.1.0.Final
    • Naming
    • None

      With the following code in a class named e.g. JNDIBinderBean.java

      private static final String name = "java:jboss/exported/JNDIBinderBean";
      private static final String value = "JNDIBinderBean instantiated at " + new Date();
      
      @PostConstruct
      public void start() {
        new InitialContext().rebind(name, value);
      }
      
      @PreDestroy
      public void stop() {
          new InitialContext().unbind(name);
      }
      
      

      When Wildfly shuts down, I get an error saying that the MSC service isn't available:

        javax.naming.NamingException: JBAS011836: Could not resolve service
          service jboss.naming.context.java.jboss.exported.JNDIBinderBean
      

            emartins@redhat.com Eduardo Martins
            rh-ee-klape Kyle Lape
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: