Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-7438

ManagedConnectionFactoryDeployer is adding an attachment with name "org.jboss.system.metadata.ServiceDeployment" which can conflict with ServiceDeploymentDeployer.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • Minor
    • 6.0.0.M2
    • JBossAS-5.1.0.GA
    • Deployers
    • None
    • Hide

      If you place a "dummy-service.xml" file in your deployment with an empty server element this will cause the execution of a different code path. This can be seen in AbstractVFSParsingDeployer::handleMultipleFiles. Notice how this method returns null. This is what will be returned to AbstractParsingDeployerWithOutput::createMetaData. There a check is performed to see if the result is null and if it is the method returns without adding the attachment in line 370:
      // Register it
      unit.getTransientManagedObjects().addAttachment(key, result, getOutput());

      Show
      If you place a "dummy-service.xml" file in your deployment with an empty server element this will cause the execution of a different code path. This can be seen in AbstractVFSParsingDeployer::handleMultipleFiles. Notice how this method returns null. This is what will be returned to AbstractParsingDeployerWithOutput::createMetaData. There a check is performed to see if the result is null and if it is the method returns without adding the attachment in line 370: // Register it unit.getTransientManagedObjects().addAttachment(key, result, getOutput());

    Description

      ManagedConnectionFactoryDeployer adds a serviceDeployment attachment using the following code:
      unit.addAttachment(ServiceDeployment.class, serviceDeployment);
      This is equivelant to:
      unit.addAttachment("org.jboss.system.metadata.ServiceDeployment", serviceDeployment);

      When ServiceDepoymentDeployer, which extends AbstractRealDeployerWithInput, has its deploy method invoked it will call unit.getAllMetaData(visitor.getVisitorType) (line 122).
      The visitor type in this case will be class org.jboss.system.metadata.ServiceDeployment.
      AbstractDeploymentUnit::getAllMetaData calls getAttachments() on line 299.
      getAttachments() will try to put all attachments into a new HashMap. It will first put all of the transient attachments. This will include the one added by the ManagedConnectionFactory,
      so the map will contain a ServiceDeployment with a key of "org.jboss.system.metadata.ServiceDepoyment".
      Next, all the transient managed objects will be put into same map. This is done with putAll. putAll will replace any existing mappings in the map. So this means that
      the value for key "org.jboss.system.metadata.ServiceDeployment" will be replaced with the one from AbstractParsingDeployerWithOutput which would be added if the deployment
      contained a single "-service.xml", but note that this is not true if the deployment contains multiple "-service.xml" files.
      This is performed on line 370 in the method createMetaData:
      // Register it
      unit.getTransientManagedObjects().addAttachment(key, result, getOutput());

      The result of this can be a deployment failure of dependencies. For example if you have a database initializer in a "-service.xml" which has a dependency to a datasource declared in a "-ds.xml" then the datasource will never get deployed.

      A solution could be to change ManagedConnectionFactoryDeployer to add the attachment with a different name:
      unit.addAttachment(getClass().getName(), serviceDeployment, ServiceDeployment.class);

      Attachments

        Activity

          People

            ajustin@redhat.com Ales Justin
            dbeveniu Daniel Bevenius (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: