1 2 Previous Next 26 Replies Latest reply on Aug 10, 2006 4:07 PM by adrian.brock

    JBAS-1841 - ServiceController/Microcontainer integration

      I've committed the initial work for this into jboss-head.

      This basically reproduces what the ServiceController did before
      except with the Microcontainer model underneath.

      There are two main differences with how it worked before,
      neither should affect working implementations. These are
      mainly about the Microcontainer's controller being more consistent
      with states.

      1) When an error occurs, the MBean is returned to the NOT_INSTALLED
      state. In the old service controller, nothing much was done to rollback
      the state, it was just marked at FAILED. What did occur happened at
      remove(). Where it would invoke destroy() and unregisterMBean()
      regardless of what state it reached prior to failure.
      If you MBean implemented ServiceMBeanSupport you wouldn't
      notice this, since its internal lifecycle would ignore any spurious
      destroy() request.

      2) The other main difference is that errors during "Instantiation"
      (i.e. mbean registration) still allow the MBean to remain under
      the controller's control and thus appear in the summary of errors
      of the "IncompleteDeploymentException".
      In the old service controller, the instantiation was done during the
      parsing of the xml which meant the context was lost if it errored.
      In the new controller, only xml parsing errors or attempts to
      register duplicate MBeans will lead to the context being unknown
      for error summary.

        • 1. Re: JBAS-1841 - ServiceController/Microcontainer integration

          Work still to do:

          1) Mostly more testing.
          The unit tests for errors are incomplete except for the "instantiation" tests.
          The different methods of describing attributes needs to be tested.
          There are currently no tests for XMBeans (except JBoss5 itself :-)

          I would have liked to complete these tests before committing,
          but I also wanted to get this into the codebase before Scott breaks it
          with the deployer changes. :-)

          2) MetaData model
          There is a ServiceMetaData model which needs enhancing to expose
          some of the newer features now possible with the Microcontainer
          in control, e.g.

          <mbean ... mode="On Demand">


          3) JMX/POJO cross injection
          This should already work underneath, but there is no real way to describe
          it at the moment.
          a) The -service.xml needs an
          <attribute name="Blah"><inject bean="POJO"/></attribute

          b) The Bean deployer needs to be udpated to use the Kernel
          created by the ServiceController rather than creating a new one
          for each deployment.

          4) Other bits and pieces
          There's a number of minor bits and pieces to tidyup.
          e.g. Should the ServiceController create the Kernel internally
          or should it be created by the ServerLoader and "injected"
          in the ServiceController?
          e.g.2 The IncompleteDeploymentException thrown by the MainDeployer
          needs updating to use the DependencyInfo from the
          underlying microcontainer controller so it picks up both JMX
          and POJO contexts
          etc.

          • 2. Re: JBAS-1841 - ServiceController/Microcontainer integration
            starksm64

            The new VDF MainDeployer and porting of the SARDeployer to the VDF will be the collision point. I'll try to merge these changes into my working copy of head today.

            Do we want to synch up with all the current head changes and make another javaee cts branch or do this mc/vdf/profilesevice work in a branch?

            In terms of "Should the ServiceController create the Kernel internally
            or should it be created by the ServerLoader and "injected"
            in the ServiceController?", can't this only be the latter? Currently the profileserivce version of the ServerLoader/ServerImpl (which is in head but not used by default: org.jboss.system.server.profileservice.ServerImpl) creates a single kernel for the entire server.

            Back to the discussion of allowing interaction between legacy mbeans and new kernel beans how can this be done unless they are in the same kernel?

            • 3. Re: JBAS-1841 - ServiceController/Microcontainer integration

               

              "scott.stark@jboss.org" wrote:

              Do we want to synch up with all the current head changes and make another javaee cts branch or do this mc/vdf/profilesevice work in a branch?


              That's your call. The changes I've made shouldn't affect
              anything. It is intended to be 100% backwards compatible.


              In terms of "Should the ServiceController create the Kernel internally
              or should it be created by the ServerLoader and "injected"
              in the ServiceController?", can't this only be the latter? Currently the profileserivce version of the ServerLoader/ServerImpl (which is in head but not used by default: org.jboss.system.server.profileservice.ServerImpl) creates a single kernel for the entire server.


              Ok, That decides that. Just need a new constructor
              new ServiceController(Kernel kernel)
              or a setKernel() method.


              Back to the discussion of allowing interaction between legacy mbeans and new kernel beans how can this be done unless they are in the same kernel?


              Yes, there should be one kernel. I do plan to support
              heirarchical kernels in the future when I get the scoping finished,
              e.g. being able to deploy a DataSource at the JMS subsystem level
              or deploy aspects into an AOPDomain at the deployment level
              but even these should be off one root.

              • 4. Re: JBAS-1841 - ServiceController/Microcontainer integration

                 

                "adrian@jboss.org" wrote:

                Ok, That decides that. Just need a new constructor
                new ServiceController(Kernel kernel)
                or a setKernel() method.


                In fact, all it really needs is the controller from
                kernel.getController()


                • 5. Re: JBAS-1841 - ServiceController/Microcontainer integration
                  slaboure

                  Congrats Adrian, that's a great step! (you really need a new laptop...) ;)

                  • 6. Re: JBAS-1841 - ServiceController/Microcontainer integration
                    weston.price

                    Oh man...you have no idea...

                    • 7. Re: JBAS-1841 - ServiceController/Microcontainer integration
                      starksm64

                      I have created a MC_VDF_WORK branch (https://svn.jboss.org/repos/jbossas/branches/MC_VDF_WORK) from the current trunk to stablize this. Once the server is booting with the BeanDeployer and SARDeployer ported over to the VDF we can merge this to head or continue porting deployers depending on how many cts related changes to deployers are happening.

                      • 8. Re: JBAS-1841 - ServiceController/Microcontainer integration
                        starksm64

                        I made good progress on tieing these together today. The server bootstrap is looking like:

                        <!-- A ProfileServiceBootstrap bootstrap descriptor that uses the simple
                        VFSDeploymentScanner that goes directly to the MainDeployer rather than the ProfileService.
                        $Id$
                        -->
                        <deployment xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                         xsi:schemaLocation="urn:jboss:bean-deployer:2.0 bean-deployer_2_0.xsd"
                         xmlns="urn:jboss:bean-deployer:2.0">
                         <!-- -->
                         <bean name="ProfileService" class="org.jboss.system.server.profileservice.ProfileServiceImpl">
                         <constructor>
                         <parameter>${jboss.server.name}</parameter>
                         </constructor>
                         <property name="profileRoot">${jboss.server.home.url}/profile</property>
                         </bean>
                        
                         <!-- The MainDeployer -->
                         <bean name="MainDeployer" class="org.jboss.deployers.plugins.MainDeployerImpl">
                         <property name="VFSFactory"><inject bean="VFSFactory"/></property>
                         </bean>
                         <!-- The factory for VFS instances -->
                         <bean name="VFSFactory" class="org.jboss.vfs.file.DefaultVFSFactory">
                         </bean>
                        
                         <!-- Deployers. Declaration order defines the deployer chain order
                         -->
                         <bean name="ClassLoadingDeployer" class="org.jboss.deployers.plugins.classloading.ClassLoadingDeployer">
                         <property name="mainDeployer"><inject bean="MainDeployer"/></property>
                         </bean>
                         <bean name="BeanDeployer" class="org.jboss.deployers.plugins.bean.BeanDeployer">
                         <property name="mainDeployer"><inject bean="MainDeployer"/></property>
                         </bean>
                         <bean name="SARDeployer" class="org.jboss.deployment.SARDeployer">
                         <property name="useNamespaceAwareParser">true</property>
                         </bean>
                        
                         <!-- A bean that setups a jboss-4.0.x type of jmx kernel to support the
                         the legacy mbean deployments handled by the SARDeployer
                         -->
                         <bean name="JMXKernel" class="org.jboss.system.server.jmx.JMXKernel">
                         <property name="serverImpl"><inject bean="ProfileService"/></property>
                         <property name="serviceController"><inject bean="SARDeployer" property="serviceController" /></property>
                         </bean>
                        
                         <!-- Hot deployment service that directly uses the MainDeployer -->
                         <bean name="VFSDeploymentScanner" class="org.jboss.deployers.plugins.scanner.VFSDeploymentScannerImpl">
                         <property name="mainDeployer"><inject bean="MainDeployer"/></property>
                         <property name="VFSFactory"><inject bean="MainDeployer" property="VFSFactory" /></property>
                         <property name="URIList">
                         <list elementClass="java.net.URI"><value>${jboss.server.home.url}/deploy/</value></list>
                         </property>
                         <property name="scanPeriod"><value>5000</value></property>
                         </bean>
                        
                        </deployment>
                        


                        The JMXKernel is a stripped down version of the jboss-4.0.x ServerImpl that sets up the jmx env needed by the SARDeployer/ServiceController. Still haven't actually gotten an mbean service to deploy, but getting close.


                        • 9. Re: JBAS-1841 - ServiceController/Microcontainer integration
                          starksm64

                          One problem I'm seeing is that the system module needs to be split up into jmx vs non-jmx based classes. If I try to run a minimal kernel that does not include any of the jmx related jars (jboss-jmx.jar, jboss-j2se.jar, jboss-mbeans.jar, dom4j.jar) and only bring these in via a JMXClassLoader associated with the SARDeployer:

                           <!-- Load the jboss jmx classes -->
                           <bean name="JMXClassLoader" class="org.jboss.vfs.classloading.VFSClassLoader">
                           <constructor factoryClass="org.jboss.vfs.classloading.VFSClassLoaderFactory"
                           factoryMethod="newClassLoader">
                           <parameter class="java.net.URL">${jboss.lib.url}</parameter>
                           <parameter>
                           <array class="[Ljava.lang.String;" elementClass="java.lang.String">
                           <value>dom4j.jar</value>
                           <value>jboss-j2se.jar</value>
                           <value>jboss-jmx.jar</value>
                           <value>jboss-mbeans.jar</value>
                           </array>
                           </parameter>
                           <parameter><inject bean="MainDeployer" property="VFSFactory"/></parameter>
                           </constructor>
                           </bean>
                           <bean name="SARDeployer" class="org.jboss.deployment.SARDeployer">
                           <classloader><inject bean="JMXClassLoader"/></classloader>
                           <property name="useNamespaceAwareParser">true</property>
                           </bean>
                          


                          this fails due to CNFE errors due to the SARDeployer being in the jboss-system.jar, which is loaded by the ServerImpl bootstrap class loader. We should not have to go to a peer repository class loading module just to be able to load the SARDeployer.

                          In reality we will want to if we want to allow interaction between mbean services and kernel beans, but this should be a choice, not forced due to the legacy jmx dependencies leaking into the jboss-system.jar. I want to break the system module into a system and system-jmx module to clean this up.



                          • 10. Re: JBAS-1841 - ServiceController/Microcontainer integration

                            A related issue is that the SARDeployer, ServiceController, etc.
                            should be in a jmx-integration module that just is a plugin
                            to the new framework.

                            That way you can choose whether you want the JMX component.

                            Making it a seperate module will also stop unwanted dependencies
                            leaking into the core framework.

                            • 11. Re: JBAS-1841 - ServiceController/Microcontainer integration
                              starksm64

                              Yes, the JMXKernel is essentially trying the integration starting point.

                              • 12. Re: JBAS-1841 - ServiceController/Microcontainer integration

                                Do you want me to complete the new ServiceController
                                in the MC_VDF_BRANCH so my changes don't get lost in refactoring, etc.?

                                • 13. Re: JBAS-1841 - ServiceController/Microcontainer integration
                                  starksm64

                                  Yes. I have already made a few changes. We need to agree on how we test this as currently the server is not booting. Are there local unit tests for this?

                                  • 14. Re: JBAS-1841 - ServiceController/Microcontainer integration
                                    starksm64

                                    Also, I'm in the process of splitting this out into a system-jmx module/project so we need to synch on that as well.

                                    1 2 Previous Next