4 Replies Latest reply on Apr 24, 2007 9:21 AM by Ales Justin

    getting a Controller

    Jean-Frederic Clere Master

      I am trying to get a Controller to call: IncompleteDeploymentsBuilder.build(mainDeployer, controller);

      What should I do to get the controller.
      I have tried:
      +++
      MBeanServer server = MBeanServerLocator.locateJBoss();
      Kernel kernel = (org.jboss.kernel.Kernel) server.getAttribute(ServiceControllerMBean.OBJECT_NAME, "kernel");
      controller = kernel.getController();
      +++
      Of the getAttribute throws "javax.management.AttributeNotFoundException: not found: kernel"

      any hints?

        • 1. Re: getting a Controller
          Ales Justin Master

          What about if you try this kernel name:

           /** The default kernel name */
           static final String KERNEL_NAME = "jboss.kernel:service=Kernel";
          


          But I think this is what your problem falls in:
          - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=105189&start=10

          Maybe the only difference is that you want to access 'core' kernel, and not new one created from "Bean Deployer".

          Where's this code that you want this?
          Where do you get mainDeployer?

          • 2. Re: getting a Controller
            Jean-Frederic Clere Master

            I want to add that code in deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java
            mainDeployer comes from there (org.jboss.deployers.spi.deployment.MainDeployer)

            • 3. Re: getting a Controller
              Jean-Frederic Clere Master

              I want to add that code in deployment/src/main/org/jboss/deployment/services/DeploymentManagerService.java
              mainDeployer comes from there (org.jboss.deployers.spi.deployment.MainDeployer)

              • 4. Re: getting a Controller
                Ales Justin Master

                There is a jsr88-service.xml:

                <server>
                 <mbean code="org.jboss.deployment.services.DeploymentManagerService"
                 name="jboss.management.local:type=JSR88DeploymentManager,name=DefaultManager">
                 <!-- The DeploymentContext attachment types that identify each deployment
                 type
                 -->
                 <attribute name="EarDeployerType">org.jboss.deployment.J2eeApplicationMetaData</attribute>
                 <attribute name="EjbDeployerType">org.jboss.metadata.ApplicationMetaData</attribute>
                 <attribute name="Ejb3DeployerType">org.jboss.ejb3.Ejb3Deployment</attribute>
                 <attribute name="RarDeployerType">org.jboss.resource.metadata.ConnectorMetaData</attribute>
                 <attribute name="WarDeployerType">org.jboss.metadata.WebMetaData</attribute>
                 <attribute name="CarDeployerType">org.jboss.ejb3.metamodel.ApplicationClientDD</attribute>
                 <!-- The MainDeployer to process deployments -->
                 <attribute name="MainDeployer"><inject bean="MainDeployer" /></attribute>
                 <attribute name="UploadDir">${jboss.server.temp.dir}/jsr88</attribute>
                 <!-- If false, the an existing deployment may exist in the upload dir -->
                 <attribute name="FailOnCollision">false</attribute>
                 <!-- If false, the deployment is retained in the upload dir -->
                 <attribute name="DeleteOnUndeploy">false</attribute>
                 </mbean>
                </server>
                


                You can just add
                 <attribute name="kernel"><inject bean="jboss.kernel:service=Kernel"/></attribute>
                


                and get an underlying Kernel instance.
                From there you get Controller. ;-)

                Or get it directly
                 <attribute name="controller"><inject bean="jboss.kernel:service=KernelController"/></attribute>
                


                Of course, both need new setter in DeploymentManagerService + instance ref. :-)