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

Sever level MBean hasn't been initialized yet when a web app starts up, causing javax.management.InstanceNotFoundException

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Major
    • None
    • JBoss AS7 7.2.0.Final
    • Web (Undertow)
    • None
    • Hide

      1. Put the attached custom module, test_valve.jar and its module.xml, into $JBOSS_HOME/modules/test/valve/main.

      This includes 2 valves, test.valve.TestValve and test.valve.TestValve2. TestValve2 looks up TestValve MBean in its start() lifecycle method. The source code is available in the jar file too.

      2. Define TestValve as a global valve in standalone.xml as follows.

              <subsystem xmlns="urn:jboss:domain:ee:1.1">
                  <global-modules>
                      <module name="test.valve" slot="main"/>
                  </global-modules>
                  ...
              </subsystem>
              ...
              <subsystem xmlns="urn:jboss:domain:web:1.4" ...>
                  ...
                  <valve name="globalConcurrentControllerValve" module="test.valve" class-name="test.valve.TestValve"/>
              </subsystem>
      

      3. Deploy attached TestWAR.war. This defines TestValve2 as an application level valve in jboss-web.xml.

      4. Start the server with debugger enabled. A break point should have been set at addValve() line of ContainerBase as follows.

      org.apache.catalina.core.ContainerBase.java
      1201#    public synchronized void addValve(Valve valve) {
      1202#
      1203#        pipeline.addValve(valve);  // <= STOP HERE
      1204#        fireContainerEvent(ADD_VALVE_EVENT, valve);
      1205#    }
      

      5. javax.management.InstanceNotFoundException is thrown in a thread of ServerService Thread Pool.

      Show
      1. Put the attached custom module, test_valve.jar and its module.xml , into $JBOSS_HOME/modules/test/valve/main . This includes 2 valves, test.valve.TestValve and test.valve.TestValve2 . TestValve2 looks up TestValve MBean in its start() lifecycle method. The source code is available in the jar file too. 2. Define TestValve as a global valve in standalone.xml as follows. <subsystem xmlns= "urn:jboss:domain:ee:1.1" > <global-modules> <module name= "test.valve" slot= "main" /> </global-modules> ... </subsystem> ... <subsystem xmlns= "urn:jboss:domain:web:1.4" ...> ... <valve name= "globalConcurrentControllerValve" module= "test.valve" class- name= "test.valve.TestValve" /> </subsystem> 3. Deploy attached TestWAR.war . This defines TestValve2 as an application level valve in jboss-web.xml . 4. Start the server with debugger enabled. A break point should have been set at addValve() line of ContainerBase as follows. org.apache.catalina.core.ContainerBase.java 1201# public synchronized void addValve(Valve valve) { 1202# 1203# pipeline.addValve(valve); // <= STOP HERE 1204# fireContainerEvent(ADD_VALVE_EVENT, valve); 1205# } 5. javax.management.InstanceNotFoundException is thrown in a thread of ServerService Thread Pool .

    Description

      With "-Dorg.apache.tomcat.util.ENABLE_MODELER=true", server level MBeans like a global valve become available. Those should be visible from start phase of a web app, though sometimes those are missing and javax.management.InstanceNotFoundException is thrown. This sporadically happens due to the parallel nature of WildFly start up. It is reproducible by using a debugger (Eclipse is better than JDB, because JDB stops all threads).

      Attachments

        1. module.xml
          0.4 kB
        2. test_valve.jar
          7 kB
        3. TestWAR.war
          1 kB

        Activity

          People

            rmaucher Remy Maucherat
            rhn-support-onagano Osamu Nagano
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated: