You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cxf.apache.org by "Aki Yoshida (JIRA)" <ji...@apache.org> on 2011/08/30 19:34:37 UTC

[jira] [Resolved] (CXF-3773) CXF unregisters MBeans for JAX-WS endpoints twice

     [ https://issues.apache.org/jira/browse/CXF-3773?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Aki Yoshida resolved CXF-3773.
------------------------------

       Resolution: Fixed
    Fix Version/s: 2.5
                   2.4.3

> CXF unregisters MBeans for JAX-WS endpoints twice
> -------------------------------------------------
>
>                 Key: CXF-3773
>                 URL: https://issues.apache.org/jira/browse/CXF-3773
>             Project: CXF
>          Issue Type: Bug
>          Components: JAX-WS Runtime
>    Affects Versions: 2.4.2
>         Environment: Tomcat 6.0.33 / Spring 3.0.[56] / Java 1.[67]
>            Reporter: Dominik Drzewiecki
>            Assignee: Aki Yoshida
>             Fix For: 2.4.3, 2.5
>
>
> 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.
> {noformat}
> 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	
> {noformat}
> {noformat}
> 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	
> {noformat}
> {noformat}
> 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	
> {noformat}
> {noformat}
> 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	
> {noformat}
> For the completness, my spring context is as simple as:
> {code:xml}
> <?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>
> {code}
> While the class and the interface exposed as a service looks somewhat like this:
> {code}
> @WebService(endpointInterface="com.xxxxx.xxx.ws.IService", serviceName="Service" )
> @Component("service")
> public class Service implements IService {
>  // implementation here
> }
> {code}
> {code}
> @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;
> }
> {code}

--
This message is automatically generated by JIRA.
For more information on JIRA, see: http://www.atlassian.com/software/jira