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

Context closed twice with Spring setup

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.3.2, 2.3.3
    • 2.3.4
    • None
    • Windows 7, both Java 5 and 6, and both Jetty 7.3 and Tomcat 7.

    Description

      See the enclosed project (very minimal).

      I have a cxf.cml and an applicationContext.xml, and loads both using ContextLoaderListener in my web.xml. I have also a CXFServlet. Starting this with Jetty, I get the following exception when I stop the server:

      28.mar.2011 23:43:15 org.springframework.context.support.AbstractApplicationContext doClose
      WARNING: Exception thrown from ApplicationListener handling ContextClosedEvent
      java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
      	at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:171)
      	at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1079)
      	at org.apache.cxf.bus.spring.BusApplicationListener.onApplicationEvent(BusApplicationListener.java:66)
      	at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:97)
      	at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:303)
      	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1007)
      	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:970)
      	at org.springframework.web.context.ContextLoader.closeWebApplicationContext(ContextLoader.java:378)
      	at org.springframework.web.context.ContextLoaderListener.contextDestroyed(ContextLoaderListener.java:78)
      	at org.eclipse.jetty.server.handler.ContextHandler.doStop(ContextHandler.java:683)
      	at org.eclipse.jetty.servlet.ServletContextHandler.doStop(ServletContextHandler.java:143)
      	at org.eclipse.jetty.webapp.WebAppContext.doStop(WebAppContext.java:458)
      	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:80)
      	at org.eclipse.jetty.server.handler.HandlerCollection.doStop(HandlerCollection.java:247)
      	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:80)
      	at org.eclipse.jetty.server.handler.HandlerWrapper.doStop(HandlerWrapper.java:108)
      	at org.eclipse.jetty.server.Server.doStop(Server.java:319)
      	at org.eclipse.jetty.util.component.AbstractLifeCycle.stop(AbstractLifeCycle.java:80)
      	at Main.main(Main.java:19)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      

      To replicate, simply run the Main method in the attached project. Then switch the CXF version in the pom.xml, and see it works with version 2.3.1. I therefore thinks this is related to CXF-3213.

      Attachments

        1. context-bug.zip
          4 kB
          Anders Båtstrand

        Issue Links

          Activity

            People

              njiang Willem Jiang
              anderius Anders Båtstrand
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: