glassfish
  1. glassfish
  2. GLASSFISH-15791

Alternatives, Interceptors and Decorators broken for archives that contain Extensions

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Fixed
    • Affects Version/s: 3.1_b37
    • Fix Version/s: None
    • Component/s: cdi
    • Labels:
      None
    • Environment:

      JDK6U23

      Description

      Assume a java library (.jar) bundled inside a web archive.

      The .jar contains an enabled alternative. The alternative works correctly unless the .jar also bundles a javax.enterprise.inject.spi.Extension implementation. In that situation the deployment fails with the following exception. This also impacts Interceptors and Decorators.

      [#|2011-02-02T13:17:00.636+0100|SEVERE|glassfish3.1|javax.enterprise.system.tools.admin.org.glassfish.deployment.admin|_ThreadID=79;_ThreadName=Thread-1;|Exception while loading the app : WELD-001423 Cannot enable the same alternative bean class [<class>org.jboss.seam.solder.test.compat.alternative.BarAlternative</class> in file:/home/jharting/jboss/appservers/glassfish-3.1-b37/glassfish3/glassfish/domains/domain1/generated/jsp/test/loader_975262726/META-INF/beans.xml@6, <class>org.jboss.seam.solder.test.compat.alternative.BarAlternative</class> in file:/home/jharting/jboss/appservers/glassfish-3.1-b37/glassfish3/glassfish/domains/domain1/generated/jsp/test/loader_975262726/META-INF/beans.xml@6] in beans.xml
      org.jboss.weld.exceptions.DeploymentException: WELD-001423 Cannot enable the same alternative bean class [<class>org.jboss.seam.solder.test.compat.alternative.BarAlternative</class> in file:/home/jharting/jboss/appservers/glassfish-3.1-b37/glassfish3/glassfish/domains/domain1/generated/jsp/test/loader_975262726/META-INF/beans.xml@6, <class>org.jboss.seam.solder.test.compat.alternative.BarAlternative</class> in file:/home/jharting/jboss/appservers/glassfish-3.1-b37/glassfish3/glassfish/domains/domain1/generated/jsp/test/loader_975262726/META-INF/beans.xml@6] in beans.xml

        Activity

        Show
        Jozef Hartinger added a comment - Test sources https://github.com/jharting/seam-solder/tree/GLASSFISH-15791/impl/src/test/java/org/jboss/seam/solder/test/compat/alternative
        Hide
        Sivakumar Thyagarajan added a comment -

        Thanks for filing this issue and providing a simple way to reproduce the issue. With the attached patch I see the war deploying and the test passing.

        Running org.jboss.seam.solder.test.compat.alternative.AlternativeTest
        Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.056 sec

        Show
        Sivakumar Thyagarajan added a comment - Thanks for filing this issue and providing a simple way to reproduce the issue. With the attached patch I see the war deploying and the test passing. Running org.jboss.seam.solder.test.compat.alternative.AlternativeTest Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 0.056 sec
        Hide
        Sivakumar Thyagarajan added a comment -

        Proposed patch for this issue

        Show
        Sivakumar Thyagarajan added a comment - Proposed patch for this issue
        Hide
        Sivakumar Thyagarajan added a comment -

        3.1 Change Control questionnaire:

        How bad is its impact? (Severity)
        Identify why the fix needs to occur now:

        • Introduces an incompatibility

        This scenario (Use of a bundled library [WEB-INF/lib/*jar]) as a Bean archive and an Extension archive is a valid scenario.

        How often does it happen? (Frequency)

        Rarely. Only scenarios where a bundled library in a WAR (a jar under WEB-INF/lib) is a Bean archive and is an Extension and includes enabled Alternatives would face this scenario. Workaround would be to move the extension, Beans/Alternatives in the bundled library into WEB-INF/classes.

        How much effort is required to fix it? (Cost)

        Fix available and attached with the issue.

        What is the risk of fixing it? (Risk)

        Not much. I have run CDI devtests. Will also run CDI TCK before commiting.

        Does a work around for the issue exist? Can the workaround be reasonably employed by the end user?

        Yes. Workaround exists. Workaround would be to move the extension, Beans/Alternatives in the bundled library into WEB-INF/classes.

        If the issue is not fixed should the issue and its workaround (if applicable) be described in the Release Notes?

        Yes.

        How long has the bug existed in the product?

        Since b39.

        Do regression tests exist for this issue?

        I will add a developer test.

        Which tests should QA (re)run to verify the fix did not destabilize GlassFish?

        SQE's CDI tests.

        When will a tested fix be ready for integration?

        By tomorrow(Feb 4th) end of day IST.

        Show
        Sivakumar Thyagarajan added a comment - 3.1 Change Control questionnaire: How bad is its impact? (Severity) Identify why the fix needs to occur now: Introduces an incompatibility This scenario (Use of a bundled library [WEB-INF/lib/*jar] ) as a Bean archive and an Extension archive is a valid scenario. How often does it happen? (Frequency) Rarely. Only scenarios where a bundled library in a WAR (a jar under WEB-INF/lib) is a Bean archive and is an Extension and includes enabled Alternatives would face this scenario. Workaround would be to move the extension, Beans/Alternatives in the bundled library into WEB-INF/classes. How much effort is required to fix it? (Cost) Fix available and attached with the issue. What is the risk of fixing it? (Risk) Not much. I have run CDI devtests. Will also run CDI TCK before commiting. Does a work around for the issue exist? Can the workaround be reasonably employed by the end user? Yes. Workaround exists. Workaround would be to move the extension, Beans/Alternatives in the bundled library into WEB-INF/classes. If the issue is not fixed should the issue and its workaround (if applicable) be described in the Release Notes? Yes. How long has the bug existed in the product? Since b39. Do regression tests exist for this issue? I will add a developer test. Which tests should QA (re)run to verify the fix did not destabilize GlassFish? SQE's CDI tests. When will a tested fix be ready for integration? By tomorrow(Feb 4th) end of day IST.
        Hide
        Sivakumar Thyagarajan added a comment -

        Analysis: When a bundled library (WEB-INF/lib/*jar) in a WAR is a Bean archive(includes beans.xml) and also bundles a javax.enterprise.inject.spi.Extension implementation, GF BDA processing logic was adding the beans.xml in the bundled library resource twice to its list. Hence an enabled Alternative/Interceptor/Decorator in the bundled library was reported to exist twice during metadata processing in Weld.

        Fix involved ensuring that only once a unique location of beans.xml is added to the BDA's beans.xml URL list.

        Show
        Sivakumar Thyagarajan added a comment - Analysis: When a bundled library (WEB-INF/lib/*jar) in a WAR is a Bean archive(includes beans.xml) and also bundles a javax.enterprise.inject.spi.Extension implementation, GF BDA processing logic was adding the beans.xml in the bundled library resource twice to its list. Hence an enabled Alternative/Interceptor/Decorator in the bundled library was reported to exist twice during metadata processing in Weld. Fix involved ensuring that only once a unique location of beans.xml is added to the BDA's beans.xml URL list.
        Hide
        Sivakumar Thyagarajan added a comment -

        Resolved through svn commits:
        trunk: Committed revision 44935.
        3.1 branch: Committed revision 44936.

        Show
        Sivakumar Thyagarajan added a comment - Resolved through svn commits: trunk: Committed revision 44935. 3.1 branch: Committed revision 44936.
        Hide
        Sivakumar Thyagarajan added a comment -

        Following commits were made to fix a FindBugs error introduced as part of the earlier commits:

        trunk: svn commit id 44959
        3.1 branch: svn commit id 44960

        Show
        Sivakumar Thyagarajan added a comment - Following commits were made to fix a FindBugs error introduced as part of the earlier commits: trunk: svn commit id 44959 3.1 branch: svn commit id 44960
        Hide
        rhorn added a comment -

        Sorry for the newbie question, but can you tell me where I can get the patch for this and how I can install it? I don't see the patch attached. Thanks much.

        Show
        rhorn added a comment - Sorry for the newbie question, but can you tell me where I can get the patch for this and how I can install it? I don't see the patch attached. Thanks much.

          People

          • Assignee:
            Sivakumar Thyagarajan
            Reporter:
            Jozef Hartinger
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: