commons-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Gary Gregory (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (DBCP-482) javax.management.InstanceNotFoundException Warning on shutdown
Date Tue, 16 Jan 2018 16:38:00 GMT

    [ https://issues.apache.org/jira/browse/DBCP-482?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16327349#comment-16327349
] 

Gary Gregory commented on DBCP-482:
-----------------------------------

I will take a look tonight or tomorrow.

> javax.management.InstanceNotFoundException Warning on shutdown
> --------------------------------------------------------------
>
>                 Key: DBCP-482
>                 URL: https://issues.apache.org/jira/browse/DBCP-482
>             Project: Commons Dbcp
>          Issue Type: Improvement
>    Affects Versions: 2.0.1, 2.1.1, 2.2.0
>         Environment: Spring Framework 4.3.11.RELEASE
> Java 1.8.0.121-b13
> MacOS Sierra
>            Reporter: Dennis Lloyd
>            Priority: Minor
>              Labels: pull-request-available
>
> When using DBCP2 with JMX, the following warning is presented upon shutting down a Spring
Application Context:
> {code}
> javax.management.InstanceNotFoundException: org.apache.commons.dbcp2:name=crawlDataSource,type=BasicDataSource
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean(DefaultMBeanServerInterceptor.java:1095)
~[na:1.8.0_121]
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.exclusiveUnregisterMBean(DefaultMBeanServerInterceptor.java:427)
~[na:1.8.0_121]
> 	at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.unregisterMBean(DefaultMBeanServerInterceptor.java:415)
~[na:1.8.0_121]
> 	at com.sun.jmx.mbeanserver.JmxMBeanServer.unregisterMBean(JmxMBeanServer.java:546) ~[na:1.8.0_121]
> 	at org.apache.commons.dbcp2.BasicDataSource.close(BasicDataSource.java:1941) ~[commons-dbcp2-2.2.0.jar:2.2.0]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
> 	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
> 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
~[na:1.8.0_121]
> 	at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]
> 	at org.springframework.beans.factory.support.DisposableBeanAdapter.invokeCustomDestroyMethod(DisposableBeanAdapter.java:364)
[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.beans.factory.support.DisposableBeanAdapter.destroy(DisposableBeanAdapter.java:287)
[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroyBean(DefaultSingletonBeanRegistry.java:578)
[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingleton(DefaultSingletonBeanRegistry.java:554)
[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingleton(DefaultListableBeanFactory.java:961)
[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.destroySingletons(DefaultSingletonBeanRegistry.java:523)
[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.destroySingletons(FactoryBeanRegistrySupport.java:230)
[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.beans.factory.support.DefaultListableBeanFactory.destroySingletons(DefaultListableBeanFactory.java:968)
[spring-beans-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1030)
[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1006)
[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> 	at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:958)
[spring-context-4.3.11.RELEASE.jar:4.3.11.RELEASE]
> {code}
> It appears that JMX begins unregistering before the connection is closed, as evidenced
by the following logs that appear shortly before the one above:
> {code}
> 2017-Dec-27-11:34:48.330 [main] INFO  o.s.j.e.a.AnnotationMBeanExporter - Unregistering
JMX-exposed beans on shutdown
> 2017-Dec-27-11:34:48.330 [main] INFO  o.s.j.e.a.AnnotationMBeanExporter - Unregistering
JMX-exposed beans
> {code}
> The following code block in the close() method is the source of the warning: 
> {code}
>         if (registeredJmxName != null) {
>             MBeanServer mbs = ManagementFactory.getPlatformMBeanServer();
>             try {
>                 mbs.unregisterMBean(registeredJmxName);
>             } catch (JMException e) {
>                 log.warn("Failed to unregister the JMX name: " + registeredJmxName, e);
>             } finally {
>                 registeredJmxName = null;
>             }
>         }
> {code}
> Would it be safe if the code instead silently ignored an InstanceNotFoundException?



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message