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

CXF unregisters MBeans for JAX-WS endpoints twice

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • 2.4.2
    • 2.4.3, 2.5
    • JAX-WS Runtime
    • None
    • Tomcat 6.0.33 / Spring 3.0.[56] / Java 1.[67]

    • Unknown

    Description

      MBeans created for JAX-WS endpoints do get unregistered twice during context shutdown.

      I've placed a breakpoint in org.apache.cxf.management.jmx.InstrumentationManagerImpl.unregister(ObjectName) and caught following stacks when reaching it. The first line shows the ObjectName being unregistered.

      You may notice that the first three stacks are observed during the CXFBus shutdown, and the fourth one during JAXWS22SpringEndpointImpl.

      The last invocation of org.apache.cxf.management.jmx.InstrumentationManagerImpl.unregister(ObjectName) results in javax.management.InstanceNotFoundException being thrown (the full message is {{"WARNING: Unregistering ManagedEndpoint failed. javax.management.InstanceNotFoundException: org.apache.cxf:bus.id=cxf52615653,type=Bus.Service.Endpoint,service="

      {http://ws.xxx.xxxxx.com/}

      Service",port="ServicePort"}}) which prevents from shutting down the endpoint bean, spring context and web application context cleanly.

      org.apache.cxf:bus.id=cxf52615653,type=Bus.Service.Endpoint,service="{http://ws.xxx.xxxxxx.com/}Service",port="ServicePort"
      Thread [main] (Suspended (entry into method unregister in InstrumentationManagerImpl))	
      	InstrumentationManagerImpl.unregister(ObjectName) line: 229	
      	InstrumentationManagerImpl.unregister(ManagedComponent) line: 225	
      	ServerImpl.destroy() line: 180	
      	ServerRegistryImpl.preShutdown() line: 88	
      	CXFBusLifeCycleManager.preShutdown() line: 84	
      	CXFBusLifeCycleManager.postShutdown() line: 91	
      	SpringBus.onApplicationEvent(ApplicationEvent) line: 94	
      	SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent) line: 97	
      	XmlWebApplicationContext(AbstractApplicationContext).publishEvent(ApplicationEvent) line: 303	
      	XmlWebApplicationContext(AbstractApplicationContext).doClose() line: 1007	
      	XmlWebApplicationContext(AbstractApplicationContext).close() line: 970	
      	ContextLoaderListener(ContextLoader).closeWebApplicationContext(ServletContext) line: 384	
      	ContextLoaderListener.contextDestroyed(ServletContextEvent) line: 78	
      	StandardContext.listenerStop() line: 4245	
      	StandardContext.stop() line: 4886	
      	StandardHost(ContainerBase).stop() line: 1110	
      	StandardEngine(ContainerBase).stop() line: 1110	
      	StandardEngine.stop() line: 468	
      	StandardService.stop() line: 604	
      	StandardServer.stop() line: 788	
      	Catalina.stop() line: 662	
      	Catalina.start() line: 629	
      	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
      	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
      	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
      	Method.invoke(Object, Object...) line: 601	
      	Bootstrap.start() line: 289	
      	Bootstrap.main(String[]) line: 414	
      
      org.apache.cxf:bus.id=cxf52615653,type=Bus.Service.Endpoint,service="{http://ws.xxx.xxxxx.com/}Service",port="Service"
      Thread [main] (Suspended (entry into method unregister in InstrumentationManagerImpl))	
      	InstrumentationManagerImpl.unregister(ObjectName) line: 229	
      	InstrumentationManagerImpl.unregister(ManagedComponent) line: 225	
      	ServerImpl.destroy() line: 180	
      	ServerRegistryImpl.preShutdown() line: 88	
      	CXFBusLifeCycleManager.preShutdown() line: 84	
      	CXFBusLifeCycleManager.postShutdown() line: 91	
      	SpringBus.onApplicationEvent(ApplicationEvent) line: 94	
      	SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent) line: 97	
      	XmlWebApplicationContext(AbstractApplicationContext).publishEvent(ApplicationEvent) line: 303	
      	XmlWebApplicationContext(AbstractApplicationContext).doClose() line: 1007	
      	XmlWebApplicationContext(AbstractApplicationContext).close() line: 970	
      	ContextLoaderListener(ContextLoader).closeWebApplicationContext(ServletContext) line: 384	
      	ContextLoaderListener.contextDestroyed(ServletContextEvent) line: 78	
      	StandardContext.listenerStop() line: 4245	
      	StandardContext.stop() line: 4886	
      	StandardHost(ContainerBase).stop() line: 1110	
      	StandardEngine(ContainerBase).stop() line: 1110	
      	StandardEngine.stop() line: 468	
      	StandardService.stop() line: 604	
      	StandardServer.stop() line: 788	
      	Catalina.stop() line: 662	
      	Catalina.start() line: 629	
      	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
      	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
      	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
      	Method.invoke(Object, Object...) line: 601	
      	Bootstrap.start() line: 289	
      	Bootstrap.main(String[]) line: 414	
      
      org.apache.cxf:bus.id=cxf52615653,type=Bus
      Thread [main] (Suspended (entry into method unregister in InstrumentationManagerImpl))	
      	InstrumentationManagerImpl.unregister(ObjectName) line: 229	
      	InstrumentationManagerImpl.shutdown() line: 263	
      	InstrumentationManagerImpl.postShutdown() line: 279	
      	CXFBusLifeCycleManager.postShutdown() line: 97	
      	SpringBus.onApplicationEvent(ApplicationEvent) line: 94	
      	SimpleApplicationEventMulticaster.multicastEvent(ApplicationEvent) line: 97	
      	XmlWebApplicationContext(AbstractApplicationContext).publishEvent(ApplicationEvent) line: 303	
      	XmlWebApplicationContext(AbstractApplicationContext).doClose() line: 1007	
      	XmlWebApplicationContext(AbstractApplicationContext).close() line: 970	
      	ContextLoaderListener(ContextLoader).closeWebApplicationContext(ServletContext) line: 384	
      	ContextLoaderListener.contextDestroyed(ServletContextEvent) line: 78	
      	StandardContext.listenerStop() line: 4245	
      	StandardContext.stop() line: 4886	
      	StandardHost(ContainerBase).stop() line: 1110	
      	StandardEngine(ContainerBase).stop() line: 1110	
      	StandardEngine.stop() line: 468	
      	StandardService.stop() line: 604	
      	StandardServer.stop() line: 788	
      	Catalina.stop() line: 662	
      	Catalina.start() line: 629	
      	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
      	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
      	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
      	Method.invoke(Object, Object...) line: 601	
      	Bootstrap.start() line: 289	
      	Bootstrap.main(String[]) line: 414	
      
      org.apache.cxf:bus.id=cxf52615653,type=Bus.Service.Endpoint,service="{http://ws.xxx.xxxxx.com/}Service",port="ServicePort"
      Thread [main] (Suspended (entry into method unregister in InstrumentationManagerImpl))	
      	InstrumentationManagerImpl.unregister(ObjectName) line: 229	
      	InstrumentationManagerImpl.unregister(ManagedComponent) line: 225	
      	ServerImpl.destroy() line: 180	
      	JAXWS22SpringEndpointImpl(EndpointImpl).stop() line: 263	
      	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
      	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
      	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
      	Method.invoke(Object, Object...) line: 601	
      	DisposableBeanAdapter.invokeCustomDestroyMethod(Method) line: 273	
      	DisposableBeanAdapter.destroy() line: 199	
      	DefaultListableBeanFactory(DefaultSingletonBeanRegistry).destroyBean(String, DisposableBean) line: 487	
      	DefaultListableBeanFactory(DefaultSingletonBeanRegistry).destroySingleton(String) line: 463	
      	DefaultListableBeanFactory(DefaultSingletonBeanRegistry).destroySingletons() line: 431	
      	XmlWebApplicationContext(AbstractApplicationContext).destroyBeans() line: 1048	
      	XmlWebApplicationContext(AbstractApplicationContext).doClose() line: 1022	
      	XmlWebApplicationContext(AbstractApplicationContext).close() line: 970	
      	ContextLoaderListener(ContextLoader).closeWebApplicationContext(ServletContext) line: 384	
      	ContextLoaderListener.contextDestroyed(ServletContextEvent) line: 78	
      	StandardContext.listenerStop() line: 4245	
      	StandardContext.stop() line: 4886	
      	StandardHost(ContainerBase).stop() line: 1110	
      	StandardEngine(ContainerBase).stop() line: 1110	
      	StandardEngine.stop() line: 468	
      	StandardService.stop() line: 604	
      	StandardServer.stop() line: 788	
      	Catalina.stop() line: 662	
      	Catalina.start() line: 629	
      	NativeMethodAccessorImpl.invoke0(Method, Object, Object[]) line: not available [native method]	
      	NativeMethodAccessorImpl.invoke(Object, Object[]) line: 57	
      	DelegatingMethodAccessorImpl.invoke(Object, Object[]) line: 43	
      	Method.invoke(Object, Object...) line: 601	
      	Bootstrap.start() line: 289	
      	Bootstrap.main(String[]) line: 414	
      

      For the completness, my spring context is as simple as:

      <?xml version="1.0" encoding="UTF-8"?>
      <beans xmlns="http://www.springframework.org/schema/beans"
      	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
      		http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
      		http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd http://cxf.apache.org/core http://cxf.apache.org/schemas/core.xsd
      		http://cxf.apache.org/jaxrs http://cxf.apache.org/schemas/jaxrs.xsd"
      	xmlns:context="http://www.springframework.org/schema/context"
      	xmlns:jaxws="http://cxf.apache.org/jaxws" xmlns:jaxrs="http://cxf.apache.org/jaxrs"
      	xmlns:cxf="http://cxf.apache.org/core">
      
      	<import resource="classpath:META-INF/cxf/cxf.xml" />
      	<import resource="classpath:META-INF/cxf/cxf-servlet.xml" />
      
      	<cxf:bus />
      
      	<bean id="instrumentationManager"
      		class="org.apache.cxf.management.jmx.InstrumentationManagerImpl" >
      		<property name="bus" ref="cxf" />
      		<property name="enabled" value="true" />
      		<property name="usePlatformMBeanServer" value="true" />
      	</bean>
      
      	<bean id="counterRepository" class="org.apache.cxf.management.counters.CounterRepository" >
      		<property name="bus" ref="cxf" />
      	</bean>
      
      	<jaxws:endpoint id="webService" implementor="#service"
      		address="${web.ws.uri}" />
      </beans>
      

      While the class and the interface exposed as a service looks somewhat like this:

      @WebService(endpointInterface="com.xxxxx.xxx.ws.IService", serviceName="Service" )
      @Component("service")
      public class Service implements IService {
       // implementation here
      }
      
      @WebService
      public interface IService {
      	@WebResult(name = "status")
      	@WebMethod(operationName = "send")
      	public boolean send(@WebParam(name = "message") SomeMessage message)
      			throws SomeException;
      
      	@Oneway
      	@WebMethod(operationName = "doSend")
      	public void doSend(@WebParam(name = "message") SomeMessage message)
      			throws SomeException;
      }
      

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            ay Akitoshi Yoshida
            drzewo Dominik Drzewiecki
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Slack

                Issue deployment