5 Replies Latest reply on Nov 13, 2008 4:28 AM by alesj

    JBAS-5689, bootstrap deployments not seen by profileservice

    starksm64

      With the current separation of the bootstrap.xml and included descriptors handled by the bootstrap ServerImpl/BasicXMLDeployer, the ProfileServiceBootstrap does not see the bootstrap services and so their managed objects/deployments are not being created.

      Just making these deployments available to the ProfileServiceBootstrap is not sufficient as the creation of the deployment ManagedObjects relies on the MainDeployer having visibility of the DeploymentContexts. The BasicXMLDeployer.deploymentsByName need to be added to the profile and main deployer as already installed deployments somehow.

      Looking forward to how the bootstrap services are managed via the profile service requires additional changes as the BasicXMLDeployer is running before the profile service even exists.

        • 1. Re: JBAS-5689, bootstrap deployments not seen by profileserv
          starksm64

          This is affecting getting hold of runtime beans like the ServerInfo bean that is loaded by the conf/jmx.xml bootstrap piece.

          So I'm looking at extending the Bootstrap interface to make the start signature:

          start(Server server, Map<String, KernelDeployment> serverDeployments)
          


          and then pass this onto the MainDeployer.addDeployment(Deployment) without having these reprocessed. It looks this would require a change in the MainDeployerImpl.addContext(DeploymentContext context, boolean addToDeploy) to look for a DeploymentState.DEPLOYED and simply add it to the deploy list, bypassing the deployers.

          Does this sound like the best approach?


          • 2. Re: JBAS-5689, bootstrap deployments not seen by profileserv
            starksm64

            In terms of Bootstraps getting access to the KernelDeployments, I have done this in a less invasive change where the Bootstrap interface remains the same, but there is now a MCServer spi that extends Server to provide access to the Kernel and KernelDeployments:

            public interface MCServer extends Server
            {
             public Kernel getKernel();
             public Map<String, KernelDeployment> getDeployments();
            }
            



            • 3. Re: JBAS-5689, bootstrap deployments not seen by profileserv
              starksm64

              It seems like we need an additional DeploymentState like EXTERNAL that flags a DeploymentUnit/DeploymentContext as not subject to the deploy/undeploy behavor of the MainDeployer. The problem with just ignoring DeploymentState.DEPLOYED deployments in addContext is that it will be undeployed when the MainDeployer is shutdown.

              Alternatively, the ManagedDeployment/ManagedObject stuff needs to be pulled out of the MainDeployer since we are interested in this information for deployments that are outside of the MainDeployer. Maybe the bootstrap ManagedDeployments can just be created separately without reference to the MainDeployer. I'll explore that more today as the current path is too invasive.

              • 4. Re: JBAS-5689, bootstrap deployments not seen by profileserv
                starksm64

                What I am trying is to build the bootstrap KernelDeployment ManagedDeployments in the ProfileServiceBootstrap start. This is working except for the conf/initialize.xml as it fails to

                Caused by: java.lang.IllegalStateException: ClassLoader has not been set
                 at org.jboss.deployers.structure.spi.helpers.AbstractDeploymentUnit.getClassLoader(AbstractDeploymentUnit.java:152)
                 at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.addBeanComponent(BeanMetaDataFactoryVisitor.java:60)
                 at org.jboss.deployers.vfs.deployer.kernel.BeanMetaDataFactoryVisitor.deploy(BeanMetaDataFactoryVisitor.java:126)
                 ... 6 more
                


                Why in the BeanMetaDataFactoryVisitor.addBeanComponent is it ok to use the className when there is only a ClassLoaderMetaData set, but no DeploymentUnit.classLoader, but if there is no ClassLoaderMetaData, we try to load the class?
                 protected static void addBeanComponent(DeploymentUnit unit, BeanMetaData bean)
                 {
                 DeploymentUnit component = unit.addComponent(bean.getName());
                 component.addAttachment(BeanMetaData.class.getName(), bean);
                 String className = bean.getBean();
                 if (className != null)
                 {
                 Object qualifier;
                 if (bean.getClassLoader() == null)
                 {
                 ClassLoader cl = unit.getClassLoader();
                 try
                 {
                 qualifier = cl.loadClass(className);
                 }
                 catch (Exception e)
                 {
                 throw new IllegalArgumentException("Exception loading class for ScopeKey addition.", e);
                 }
                 }
                 else
                 {
                 qualifier = className;
                 }
                 component.getScope().addScope(CommonLevels.CLASS, qualifier);
                 }
                 }
                



                • 5. Re: JBAS-5689, bootstrap deployments not seen by profileserv
                  alesj

                   

                  "scott.stark@jboss.org" wrote:

                  Why in the BeanMetaDataFactoryVisitor.addBeanComponent is it ok to use the className when there is only a ClassLoaderMetaData set, but no DeploymentUnit.classLoader, but if there is no ClassLoaderMetaData, we try to load the class?

                  This 3 page discussion explains why:
                  - http://www.jboss.com/index.html?module=bb&op=viewtopic&t=144593