Uploaded image for project: 'Solder'
  1. Solder
  2. SOLDER-322

Solder Servlet extensions clashing with CDI 1.1

    Details

    • Steps to Reproduce:
      Hide

      Use the attached .war file directly, or:


      Using jboss-as-quickstarts example kitchensink-jsp. Add the following to POM

      <dependency>
      <groupId>org.jboss.seam.persistence</groupId>
      <artifactId>seam-persistence</artifactId>
      <version>3.1.0.Final</version>
      </dependency>

      maven clean and install

      Following Exceptions thrown on Enable in JBoss following deployment

      org.jboss.weld.exceptions.DeploymentException:
      WELD-001409 Ambiguous dependencies for type [HttpServletRequest] with qualifiers [@Default] at injection point [[field]
      @Inject private org.jboss.solder.servlet.http.RedirectBuilderImpl.request].
      Possible dependencies [[
      Producer Method [HttpServletRequest] with qualifiers [@Any @Default] declared as [[method] @Produces @Typed @RequestScoped protected
      org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()],
      org.jboss.weld.bean-jboss-as-kitchensink-jsp.war/C:/jboss-as-7.1.0.CR1b/bin/content/jboss-as-kitchensink-jsp.war/WEB-INF/lib/solder-impl-3.1.0.Final.jar-Built-in-org.jboss.weld.bean.builtin.ee.HttpServletRequestBean]]

      Show
      Use the attached .war file directly, or: Using jboss-as-quickstarts example kitchensink-jsp. Add the following to POM <dependency> <groupId>org.jboss.seam.persistence</groupId> <artifactId>seam-persistence</artifactId> <version>3.1.0.Final</version> </dependency> maven clean and install Following Exceptions thrown on Enable in JBoss following deployment org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [HttpServletRequest] with qualifiers [@Default] at injection point [ [field] @Inject private org.jboss.solder.servlet.http.RedirectBuilderImpl.request]. Possible dependencies [[ Producer Method [HttpServletRequest] with qualifiers [@Any @Default] declared as [ [method] @Produces @Typed @RequestScoped protected org.jboss.solder.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()], org.jboss.weld.bean-jboss-as-kitchensink-jsp.war/C:/jboss-as-7.1.0.CR1b/bin/content/jboss-as-kitchensink-jsp.war/WEB-INF/lib/solder-impl-3.1.0.Final.jar-Built-in-org.jboss.weld.bean.builtin.ee.HttpServletRequestBean]]

      Description

      Solder's Servlet extensions use the default qualifier for certain beans such as ServletRequest. This clashes with built-in beans added in CDI 1.1 and results in AmbiguousResolutionException during deployment.

      I think there are two ways around:

      • to introduce a Solder-specific qualifier so that the "@Default" space is not poluted or
      • detect CDI version and based on that either provide or not provide the overlapping Servlet integration

      When trying out Weld 2.0.0 Alpha implementation as suggested by Weld developer (Jozef) as per Forum reference, I encountered problems starting application when including seam-persistence 3.1.0.Final in project.

      I have reproduced this in quickstart example in 7.1.0.CR1b with Weld 2.0.0. The error doesn't happen in 7.0.2.Final and 7.1.1.Final

      Code files and result details for these can be provided if required (can't see how to upload).

        Gliffy Diagrams

        1. 0002-Workaround-for-SOLDER-322.patch
          5 kB
          Jozef Hartinger
        2. Seam-Persistence - 7_0_2.txt
          5 kB
          David Hubbard
        3. Seam-Persistence - 7_1_0_CR1b_Weld.txt
          3 kB
          David Hubbard
        4. Seam-Persistence - 7_1_1.txt
          2 kB
          David Hubbard

          Activity

          Hide
          dazed David Hubbard added a comment -

          Zip file - code from quickstart + POM edits

          + 3 sets of results with different <dependencies> in POM

          Show
          dazed David Hubbard added a comment - Zip file - code from quickstart + POM edits + 3 sets of results with different <dependencies> in POM
          Hide
          jharting Jozef Hartinger added a comment -

          Dave, thanks for reporting. This is going to require change in Solder. In the meantime you can work around in your application by disabling conflicting part of Solder. I am attaching a patch for the reproducer application which does that.

          Show
          jharting Jozef Hartinger added a comment - Dave, thanks for reporting. This is going to require change in Solder. In the meantime you can work around in your application by disabling conflicting part of Solder. I am attaching a patch for the reproducer application which does that.
          Hide
          dazed David Hubbard added a comment -

          Jozef, thanks I've applied your patch ok to the quickstart example and deployed that fine - I did have to digest the diff file a little (what with the a and b folders it seemed to create when run in Eclipse). Will try it on my project which actually uses Seam Persistence shortly.

          Couple of questions - 1) what version of JBoss AS are you targeting for Weld 2.0.0 ? 2) Once it's finalised will it be available to add on to JBoss 7.1.x?

          Thanks for your help here.

          Show
          dazed David Hubbard added a comment - Jozef, thanks I've applied your patch ok to the quickstart example and deployed that fine - I did have to digest the diff file a little (what with the a and b folders it seemed to create when run in Eclipse). Will try it on my project which actually uses Seam Persistence shortly. Couple of questions - 1) what version of JBoss AS are you targeting for Weld 2.0.0 ? 2) Once it's finalised will it be available to add on to JBoss 7.1.x? Thanks for your help here.

            People

            • Assignee:
              Unassigned
              Reporter:
              dazed David Hubbard
            • Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:

                Development