glassfish
  1. glassfish
  2. GLASSFISH-19493

CDI dependency injection fails for JAXWS handler classes

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.1.2.2
    • Fix Version/s: 4.0
    • Component/s: cdi, web_services
    • Labels:
      None
    • Environment:

      Ubuntu 12.04.1 64bit
      Oracle JDK 1.7.0.10

      Description

      The Java EE 6 specification lists JAXWS handlers as component classes that are supporting injection (see page 69, table EE.5-1).

      It seams, that within Glassfish 3.1.2.2 (build 5) @Inject is not resolved for handler classes. Is this a known bug?

      I have found a forum posting (http://forums.java.net/node/873115) that has not been answered yet.

      The attached sample demonstrates this issue.

      • ServerSideTicketHandler is a JAXWS handler that has dependency to TicketFactory (should be resolved via @Inject). Since DI does not work "ticketFactory is null" is logged to System.out.
      • ProductServiceEndpoint is the service implementation that itself delegates the method call to ProductRepository (here @Inject works as expected).

        Activity

        Hide
        DimitriJakov added a comment - - edited

        Unfortunately, injection still does not work for handlers attached to web service clients via @HandlerChain annotation and XML file (at least). The mechanism for their instantiation is different from that of endpoints. See com/sun/xml/ws/handler/HandlerChainsModel.java:272:

        handler = (Handler) loadClass(classLoader,
            XMLStreamReaderUtil.getElementText(reader).trim()).newInstance();
        

        Seems like handlers are simply instantiated, with no signs of injections being processed.

        If needed, I can supply a MWE and a stack trace to demonstrate the issue. (GlassFish v4.0 build 89, Oracle JDK 1.7.0_45)

        Show
        DimitriJakov added a comment - - edited Unfortunately, injection still does not work for handlers attached to web service clients via @HandlerChain annotation and XML file (at least). The mechanism for their instantiation is different from that of endpoints. See com/sun/xml/ws/handler/HandlerChainsModel.java:272: handler = (Handler) loadClass(classLoader, XMLStreamReaderUtil.getElementText(reader).trim()).newInstance(); Seems like handlers are simply instantiated, with no signs of injections being processed. If needed, I can supply a MWE and a stack trace to demonstrate the issue. (GlassFish v4.0 build 89, Oracle JDK 1.7.0_45)
        Hide
        arjavdesai added a comment -

        Revision 60836 should fix the issue.

        Show
        arjavdesai added a comment - Revision 60836 should fix the issue.
        Hide
        arjavdesai added a comment -

        tomkri,

        I don't see the attachment. Can you please upload the same?

        thanks!

        Show
        arjavdesai added a comment - tomkri, I don't see the attachment. Can you please upload the same? thanks!

          People

          • Assignee:
            arjavdesai
            Reporter:
            tomkri
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: