Uploaded image for project: 'JBoss Enterprise Application Platform 4 and 5'
  1. JBoss Enterprise Application Platform 4 and 5
  2. JBPAPP-4209

LegacyDeploymentContextComparator can cause NullPointerException when not defined as an MC bean

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • EAP_EWP 5.1.0
    • EAP 5.0.1
    • System
    • None
    • Hide

      Configure the <jboss-home>/server/<server-dir>/conf/bootstrap/deployer.xml to use the LegacyPrefixDeploymentContextComparator and deploy an ear that contains multiple jar files.

      Show
      Configure the <jboss-home>/server/<server-dir>/conf/bootstrap/deployer.xml to use the LegacyPrefixDeploymentContextComparator and deploy an ear that contains multiple jar files.
    • Workaround Exists
    • Hide

      There are two workarounds:

      1 - Define a LegacyDeploymentContextComparator MC bean in, for example, <jboss-home>/server/<server-dir>/conf/bootstrap/deployer.xml to cause the create() method to be called:

      <bean name="legacyContextComparator">
      <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/>
      </bean>

      2 - configure the use of the topContextComparator replacement (e.g., LegacyPrefixDeploymentContextComparator) in the <jboss-home>/server/<server-dir>/deployers/ear-deployer-jboss-beans.xml for the EARStructureDeployer's comparatorClassName property:

      <deployment xmlns="urn:jboss:bean-deployer:2.0">
      <bean name="EARStructureDeployer" class="org.jboss.deployment.EARStructure">
      <property name="comparatorClassName">org.jboss.system.deployers.LegacyPrefixDeploymentContextComparator</property>
      ...

      Show
      There are two workarounds: 1 - Define a LegacyDeploymentContextComparator MC bean in, for example, <jboss-home>/server/<server-dir>/conf/bootstrap/deployer.xml to cause the create() method to be called: <bean name="legacyContextComparator"> <constructor factoryClass="org.jboss.system.deployers.LegacyDeploymentContextComparator" factoryMethod="getInstance"/> </bean> 2 - configure the use of the topContextComparator replacement (e.g., LegacyPrefixDeploymentContextComparator) in the <jboss-home>/server/<server-dir>/deployers/ear-deployer-jboss-beans.xml for the EARStructureDeployer's comparatorClassName property: <deployment xmlns="urn:jboss:bean-deployer:2.0"> <bean name="EARStructureDeployer" class="org.jboss.deployment.EARStructure"> <property name="comparatorClassName">org.jboss.system.deployers.LegacyPrefixDeploymentContextComparator</property> ...

      The LegacyDeploymentContextComparator requires that it's create() method be called to be properly initialized. However, it is used by the EARStructureDeployer bean (configured in the <jboss-home>/server/<server-dir>/deployers/ear-deployer-jboss-beans.xml) which makes no such lifecycle assumption. By default, this works because the LegacyDeploymentContextComparator is instantiated as an MC bean (topContextComparator) in <jboss-home>/server/<server-dir>/conf/bootstrap/deploy.xml causing it's create() method to be called as part of the MC bean lifecycle. However, if the topContextComparator is replaced by, for example, the LegacyPrefixDeploymentContextComparator, use of the LegacyDeploymentContextComparator by the EARStructureDeployer can lead to a NPE during EAR deployments. (See discussion on JBAS-7614.)

            rhn-support-miclark Mike Clark
            rhn-support-miclark Mike Clark
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: