NullPointer Warning for ApplicationListener handling ContextClosedEvent

Viewed 1479

I have a Spring Boot Apache CXF web application. It is running just fine. However whenever I close down the application I get a warning about a nullpointer from the ApplicationListener handling ContextClosedEvent. It looks like it might be related to the Apache CXF bus.

11:10:24.728 INFO  [Thread-10][AnnotationConfigEmbeddedWebApplicationContext] Closing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@39b667c3: startup date [Thu May 11 11:09:48 PDT 2017]; root of context hierarchy
11:10:24.738 WARN  [Thread-10][AnnotationConfigEmbeddedWebApplicationContext] Exception thrown from ApplicationListener handling ContextClosedEvent
java.lang.NullPointerException: null
    at java.util.concurrent.ConcurrentHashMap.replaceNode(ConcurrentHashMap.java:1106)
    at java.util.concurrent.ConcurrentHashMap.remove(ConcurrentHashMap.java:1097)
    at org.apache.cxf.transport.http.DestinationRegistryImpl.removeDestination(DestinationRegistryImpl.java:63)
    at org.apache.cxf.transport.http.AbstractHTTPDestination.deactivate(AbstractHTTPDestination.java:961)
    at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:65)
    at org.apache.cxf.endpoint.ServerImpl.stop(ServerImpl.java:174)
    at org.apache.cxf.endpoint.ServerImpl.destroy(ServerImpl.java:180)
    at org.apache.cxf.bus.managers.ServerRegistryImpl.preShutdown(ServerRegistryImpl.java:90)
    at org.apache.cxf.bus.managers.CXFBusLifeCycleManager.preShutdown(CXFBusLifeCycleManager.java:97)
    at org.apache.cxf.bus.extension.ExtensionManagerBus.shutdown(ExtensionManagerBus.java:326)
    at org.apache.cxf.bus.extension.ExtensionManagerBus.shutdown(ExtensionManagerBus.java:313)
    at org.apache.cxf.bus.spring.SpringBus.onApplicationEvent(SpringBus.java:109)
    at org.apache.cxf.bus.spring.SpringBus$1.onApplicationEvent(SpringBus.java:58)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.invokeListener(SimpleApplicationEventMulticaster.java:166)
    at org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:138)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:382)
    at org.springframework.context.support.AbstractApplicationContext.publishEvent(AbstractApplicationContext.java:336)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:989)
    at org.springframework.context.support.AbstractApplicationContext$2.run(AbstractApplicationContext.java:923)
11:10:24.780 INFO  [Thread-10][AnnotationMBeanExporter] Unregistering JMX-exposed beans on shutdown

Here is a class I wrote that I think the error may be stemming from, but I am not sure.

import javax.xml.ws.Endpoint;
import org.apache.cxf.Bus;
import org.apache.cxf.jaxws.EndpointImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import com.amazonaws.services.s3.AmazonS3;
import com.amazonaws.services.s3.AmazonS3ClientBuilder;


@Configuration
public class EndpointConfig {

    @Autowired
    private Bus bus;

    @Autowired
    private AmazonS3 s3client;

    @Bean
    public Endpoint endpoint() {
      EndpointImpl endpoint = new EndpointImpl(bus,
            new AcmeWebServiceImpl(s3client));
      endpoint.publish();
      return endpoint;
  }

  @Bean 
  public AmazonS3 amazonS3(){
     AmazonS3 amazonS3 = AmazonS3ClientBuilder.defaultClient();
     return amazonS3;
  }
}
1 Answers
Related