CXF
  1. CXF
  2. CXF-4094

Refreshing Spring application context leads to NPE

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.4, 2.5
    • Fix Version/s: 2.4.7, 2.5.3
    • Component/s: Bus
    • Labels:
      None
    • Estimated Complexity:
      Unknown

      Description

      I have a web application that uses Spring and CXF (currently 2.4.2 but I have reproduced this on 2.4.6 and 2.5.2 as well) and is deployed on Tomcat.

      The application is initialized using the org.springframework.web.context.ContextLoaderListener.

      Starting and shutting the application down works like a charm but if I try to refresh the Spring application context, using ((ConfigurableApplicationContext)applicationContext).refresh(); I run into problems.

      The application context first destroys all its beans (including CXFBusImpl, or rather its subclass SpringBus). SpringBus however calls ctx.close() on its application context - leading to a NullPointerException when the application context shortly after tries to close its bean factory:

      java.lang.NullPointerException 
          at org.springframework.context.support.AbstractRefreshableApplicationContext.closeBeanFactory(AbstractRefreshableApplicationContext.java:152) 
          at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:124) 
          at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:467) 
          at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:397)}}
      

      I think that SpringBus shouldn't call ctx.close() in destroyBeans(). I tried removing this row and rebuilding CXF myself which fixed the problem (and I couldn't detect any other problems starting or shutting down).

        Issue Links

          Activity

          Jens Borgland made changes -
          Link This issue relates to CXF-4127 [ CXF-4127 ]
          Jens Borgland made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Hide
          Jens Borgland added a comment -

          Verified in:
          2.4.7 snapshot build 20120216.070257-12
          2.5.3 snapshot build 20120216.075050-14.

          Show
          Jens Borgland added a comment - Verified in: 2.4.7 snapshot build 20120216.070257-12 2.5.3 snapshot build 20120216.075050-14.
          Daniel Kulp made changes -
          Field Original Value New Value
          Status Open [ 1 ] Resolved [ 5 ]
          Assignee Daniel Kulp [ dkulp ]
          Fix Version/s 2.4.7 [ 12319492 ]
          Fix Version/s 2.5.3 [ 12319491 ]
          Resolution Fixed [ 1 ]
          Jens Borgland created issue -

            People

            • Assignee:
              Daniel Kulp
              Reporter:
              Jens Borgland
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development