Tag Archives: javax.management.InstanceNotFoundException

[Solved] javax.management.InstanceNotFoundException: com.alibaba.druid:type=DruidDataSourceStat

There was a problem when the test server restarted Tomcat

javax.management.InstanceNotFoundException: com.alibaba.druid:type=DruidDataSourceStat

the main reason for the error: 

there are multiple Tomcat on the server, and they all use Druid  to do so

solution: 

modify the catalina.sh :
add this sentence Code: Java_ OPTS=”- Ddruid.registerToSysProperty=true ”

 

How to Solve ERROR – unregister mbean error javax.management.InstanceNotFoundException: com.alibaba.druid:type=

In the project, Druid is used to manage the database connection pool. There is no problem in the local and test environment. However, after the production environment, when Tomcat is started for the first time, the log does not report an error, but the page can’t come out. When Tomcat is closed, you can see the log and find that the error is as follows:

ERROR [ com.alibaba.druid . stat.DruidDataSourceStatManager ] – unregister mbean error
javax.management.InstanceNotFoundException : com.alibaba.druid :type=DruidDataSourceStat
at com.sun.jmx . interceptor.DefaultMBeanServerInterceptor .getMBean………

 

Various methods have been found on the Internet, but they are all vague. After many tests, the solution is as follows:

Modify the bin directory of Tomcat catalina.sh File in OS specific support. $var_ must_ Be set to either true or false

JAVA_ OPTS=”- Ddruid.registerToSysProperty=true “OK, as shown in the figure:

After tomcat, just start the deployment project once and don’t report this error again.