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

Seam Servlet broken in multi-war ear deployment

    Details

    • Type: Bug
    • Status: Open (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 3.0.0.Final
    • Fix Version/s: Future
    • Component/s: None
    • Labels:
      None
    • Affects:
      Documentation (Ref Guide, User Guide, etc.), Release Notes
    • Workaround:
      Workaround Exists
    • Workaround Description:
      Hide

      There is a partial workaround:

      Deploy Seam Servlet within $

      {ear.home}

      /lib and copy the content of Seam Servlet web-fragment.xml to the web application't web.xml. With these changes in place, Seam Servlet will work with the following limitations:

      • Servlet event observers (e.g. @Observes @Initialized ServletContext) will be invoked for every web application
      • injection of @ApplicationScoped Servlet objects does not work (i.e. ServletContext of the web application that was registered last is injected to every web application)
      Show
      There is a partial workaround: Deploy Seam Servlet within $ {ear.home} /lib and copy the content of Seam Servlet web-fragment.xml to the web application't web.xml. With these changes in place, Seam Servlet will work with the following limitations: Servlet event observers (e.g. @Observes @Initialized ServletContext) will be invoked for every web application injection of @ApplicationScoped Servlet objects does not work (i.e. ServletContext of the web application that was registered last is injected to every web application)

      Description

      The Servlet specification requires a java library to be bundled within the WEB-INF/lib folder for its web-fragment.xml to be read. Therefore, if multiple web applications using Seam Servlet are bundled within an EAR, they all have to package Seam Servlet within their WEB-INF/lib folders.

      The CDI specification is not clear in defining the application scope in an EAR (See https://issues.jboss.org/browse/CDI-129 for details.)

      JBoss AS 7 implements the application scope as per-ear.

      This results in conflicts between multiple instances of Seam Servlet. Therefore, when the ear is deployed, the deployment fails with AmbiguousResolutionException like the following one:

      15:14:42,467 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-7) MSC00001: Failed to start service jboss.deployment.unit."test.ear".WeldService: org.jboss.msc.service.StartException in service jboss.deployment.unit."test.ear".WeldService: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [HttpServletRequest] with qualifiers [@Default] at injection point [[field] @Inject private org.jboss.seam.servlet.http.CookieParamProducer.request]. Possible dependencies [[Producer Method [HttpServletRequest] with qualifiers [@Any @Default] declared as [[method] @Produces @Typed @RequestScoped protected org.jboss.seam.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()], Producer Method [HttpServletRequest] with qualifiers [@Any @Default] declared as [[method] @Produces @Typed @RequestScoped protected org.jboss.seam.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()]]]
      at org.jboss.as.weld.services.WeldService.start(WeldService.java:96)
      at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1765)
      at org.jboss.msc.service.ServiceControllerImpl$ClearTCCLTask.run(ServiceControllerImpl.java:2291)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886) [:1.6.0_24]
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908) [:1.6.0_24]
      at java.lang.Thread.run(Thread.java:662) [:1.6.0_24]
      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001409 Ambiguous dependencies for type [HttpServletRequest] with qualifiers [@Default] at injection point [[field] @Inject private org.jboss.seam.servlet.http.CookieParamProducer.request]. Possible dependencies [[Producer Method [HttpServletRequest] with qualifiers [@Any @Default] declared as [[method] @Produces @Typed @RequestScoped protected org.jboss.seam.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()], Producer Method [HttpServletRequest] with qualifiers [@Any @Default] declared as [[method] @Produces @Typed @RequestScoped protected org.jboss.seam.servlet.http.ImplicitHttpServletObjectsProducer.getHttpServletRequest()]]]
      at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:274)
      at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:106)
      at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:129)
      at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:351)
      at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:336)
      at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:404)
      at org.jboss.as.weld.WeldContainer.start(WeldContainer.java:82)
      at org.jboss.as.weld.services.WeldService.start(WeldService.java:89)
      ... 5 more

        Gliffy Diagrams

          Issue Links

            Activity

            Hide
            jharting Jozef Hartinger added a comment -

            Also, the CDI spec says:

            "If a bean class is deployed in two different bean archives, non-portable behavior results. Portable applications must deploy
            each bean class in no more than one bean archive."

            Show
            jharting Jozef Hartinger added a comment - Also, the CDI spec says: "If a bean class is deployed in two different bean archives, non-portable behavior results. Portable applications must deploy each bean class in no more than one bean archive."
            Hide
            lightguard Jason Porter added a comment -

            It sounds like this is spec related and really nothing we can do that will be portable, is that correct?

            Show
            lightguard Jason Porter added a comment - It sounds like this is spec related and really nothing we can do that will be portable, is that correct?
            Hide
            jharting Jozef Hartinger added a comment -

            Yes, I cannot see how we could make Seam Servlet work with multi-war ears and still remain portable.

            Show
            jharting Jozef Hartinger added a comment - Yes, I cannot see how we could make Seam Servlet work with multi-war ears and still remain portable.

              People

              • Assignee:
                Unassigned
                Reporter:
                jharting Jozef Hartinger
              • Votes:
                1 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:

                  Development