Uploaded image for project: 'WildFly'
  1. WildFly
  2. WFLY-4350

PicketLink producer method is not registered in a @WebListener managed bean

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: Major Major
    • None
    • 8.2.0.Final
    • CDI / Weld
    • None

      1. A WAR declares dependencies on PicketLink 2.7.0.CR3 and is Jandex-indexed

      <jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
          <deployment>
              <dependencies>
                  <!-- You must configure the PicketLink dependency to your deployment. The dependency above is
                  a reference to a static module from WildFly modules directory. -->
                  <module name="org.picketlink.core.api" meta-inf="import" annotations="true" />
                  <module name="org.picketlink.idm.api" meta-inf="import" annotations="true" />
                  <module name="org.picketlink.core" meta-inf="import" annotations="true" />
                  <module name="org.picketlink.idm" meta-inf="import" annotations="true" />
                  <module name="org.picketlink.common" meta-inf="import" annotations="true" />
              </dependencies>
          </deployment>
      </jboss-deployment-structure>
      

      2. A WAR is deployed but requests for protected resources fail with 500-error:

      2015-02-13 17:03:00,707 ERROR [org.picketlink.http] (default task-1) Exception thrown during processing for path [/newWEBEar/test.html]. Sending error with status code [500].: org.jboss.weld.exceptions.UnsatisfiedResolutionException: WELD-001308: Unable to resolve any beans for Type: interface javax.servlet.http.HttpServletRequest; Qualifiers: [@org.picketlink.annotations.PicketLink()]
        at org.jboss.weld.bean.builtin.InstanceImpl.get(InstanceImpl.java:84) [weld-core-impl-2.2.6.Final.jar:2014-10-03 10:05]
        at org.picketlink.http.internal.SecurityFilter.doFilter(SecurityFilter.java:159) [picketlink-impl-2.7.0.CR3.jar:]
        at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:61) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at org.wildfly.extension.undertow.security.SecurityContextAssociationHandler.handleRequest(SecurityContextAssociationHandler.java:78)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.SSLInformationAssociationHandler.handleRequest(SSLInformationAssociationHandler.java:131) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.ServletAuthenticationCallHandler.handleRequest(ServletAuthenticationCallHandler.java:56) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:45) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:63) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.security.handlers.AuthenticationMechanismsHandler.handleRequest(AuthenticationMechanismsHandler.java:58) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:261) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:247) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:76) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:166) [undertow-servlet-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.Connectors.executeRootHandler(Connectors.java:197) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:759) [undertow-core-1.1.0.Final.jar:1.1.0.Final]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_31]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_31]
        at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_31]
      

      3. org.picketlink.http.internal.SecurityFilter.doFilter fails to inject HttpServletRequest produced in HttpServletRequestListener because producer is never registered and therefore is never injected.

      The cause of this is as follows:

      1. ExternalBeanArchiveProcessor line 161 discovers HttpServletRequestListener.
      2. However, ExternalBeanArchiveProcessor line 164 removes HttpServletRequestListener from the list of the discovered classes, because the class name is in the set of the componentClassNames
      3. HttpServletRequestListener is added to componentClassNames on ExternalBeanArchiveProcessor line 120
      4. EEModuleDescription moduleDesc = deployment.getAttachment(org.jboss.as.ee.component.Attachments.EE_MODULE_DESCRIPTION); retrieves WebComponentProcessor, that gets attached on line 133

      The expected behavior would, naturally, be HttpServletRequestListener successfully being added as a managed bean with producers being recognized.
      Weld appears to function normally, so does the PicketLink. Only the integration between WildFly and Weld introduces this out-of-CDI-spec behavior.

        1. weld-filtered.log
          502 kB
          Arcadiy Ivanov
        2. weld-HttpServletRequestListener.log
          1 kB
          Arcadiy Ivanov

              sdouglas1@redhat.com Stuart Douglas (Inactive)
              arcivanov_jira Arcadiy Ivanov (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: