Uploaded image for project: 'CXF'
  1. CXF
  2. CXF-2620

CXFServlet fails to init with NPE at line 125 (updateContext) when run with embedded Jetty and Spring3 - works with Spring 2.5.6

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.2.5
    • 2.1.9, 2.2.6
    • Transports
    • None
    • Spring 3.0.0.RELEASE / Jetty 6.1.8 (embedded)

    Description

      I have been using CXF 2.2.3 (also tested with 2.2.5) with Spring 2.5.6 and an embedded Jetty instance successfully for several months. After the release of Spring 3.0, I have tried migrating to the new Spring version. Now the CXF Servlet is failing with a nullpointerexception on the 'updateContext' method:

      Caused by: java.lang.NullPointerException
      at org.apache.cxf.transport.servlet.CXFServlet.updateContext(CXFServlet.java:125)
      at org.apache.cxf.transport.servlet.CXFServlet.onApplicationEvent(CXFServlet.java:182)
      at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
      at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:294)
      at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:296)
      at org.springframework.context.support.AbstractApplicationContext.finishRefresh(AbstractApplicationContext.java:858)
      at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:419)

      The line that is failing is:

      resourceManager.addResourceResolver(new ServletContextResourceResolver(servletConfig.getServletContext()));

      I can only reproduce this issue using an 'embedded' jetty instance, I have attached a test case. By switching between spring 2.5.6 and spring 3.0, you can see from the log output that the servlet successfully initialized under 2.5.6, but fails under 3.0.

      I understand this may be a very narrow case involving only this method of loading the servlet, so if no fix is required in CXF, some advice as to a workaround would be very welcome. Thank you.

      Attachments

        1. embedded-jetty-tests.zip
          7 kB
          William (BJ) Blackburn

        Activity

          People

            dkulp Daniel Kulp
            wjblackburn@me.com William (BJ) Blackburn
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: