Uploaded image for project: 'WildFly Core'
  1. WildFly Core
  2. WFCORE-449

MBeanRegistrationService throws NameNotFoundException "java:comp/BeanManager" when starting/stoping the MBean

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 1.0.0.Alpha14
    • 1.0.0.Alpha13
    • None

      This issue happens if you create an MBean in your EJB and deploy the EJB. The steps to reproduce the issue is the following:

      git clone https://github.com/zhfeng/test_jmx_ejb
      cd test_jmx_ejb
      mvn clean install
      

      After starting the wildfly server, copy the test_jmx_ejb-1.0.jar to the deployment directory of the wildfly and you will see the exception

      11:39:30,064 ERROR [org.jboss.as.weld] (MSC service thread 1-8) WFLYWELD0002: Failed to tear down Weld contexts: javax.naming.NameNotFoundException: java:comp/BeanManager
      	at org.jboss.as.naming.InitialContext$DefaultInitialContext.findContext(InitialContext.java:187)
      	at org.jboss.as.naming.InitialContext$DefaultInitialContext.lookup(InitialContext.java:231)
      	at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:188)
      	at org.jboss.as.naming.NamingContext.lookup(NamingContext.java:184)
      	at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_21]
      	at javax.naming.InitialContext.lookup(InitialContext.java:411) [rt.jar:1.7.0_21]
      	at org.jboss.as.weld.arquillian.WeldContextSetup.teardown(WeldContextSetup.java:108)
      	at org.jboss.as.jmx.MBeanRegistrationService.start(MBeanRegistrationService.java:106) [wildfly-jmx-1.0.0.Alpha9.jar:1.0.0.Alpha9]
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
      	at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
      	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_21]
      	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_21]
      	at java.lang.Thread.run(Thread.java:722) [rt.jar:1.7.0_21]
      

      It looks like the JavaNamespaceSetup teardown happens before the WeldContextSetup so it throws NameNotFoundException in the WeldContextSetup teardown.

      The possible fix is to reverse calling the setupActions.

              zfeng@redhat.com Zheng Feng
              zfeng@redhat.com Zheng Feng
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: