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.
Read More:
- [Solved] javax.management.InstanceNotFoundException: com.alibaba.druid:type=DruidDataSourceStat
- [Solved] Druid register MBean error: ERROR [com.alibaba.druid.stat.DruidDataSourceStatManager]
- [Solved] com.alibaba.druid.pool.DruidDataSource – create connecti
- com.alibaba.druid.pool.DruidDataSource error Warning: init datasource error
- Keytool: How to solve javax.net.ssl.SSLHandshakeException Error?
- [Solved] Failed to bind properties under ‘spring.datasource.type‘ to java.lang.Class<javax.sql.DataSource>
- How to Solve Error: Element ‘dependency’ cannot have character [children], because the type’s content type is element-
- Calling Dubbo Service reported the following error (com.alibaba.dubbo.remoting.RemotingException) Causes and Solutions
- How to Solve Error “Could not find com.android.tools.build:gradle:3.0.1”
- How to Solve Error: Type mismatch: cannot convert from Object to Car
- [Solved] fastjson Error: com.alibaba.fastjson.JSONObject cannot be cast to xxxx
- Request processing failed; nested exception is com.alibaba.fastjson.JSONException: can not cast to J
- How to Solve Springboot Error: Failed to convert value of type
- How to Solve Error Swift 4 Expression type ‘@value CGRect’ is ambiguous without more context
- How to Solve Error: Missing type map configuration or unsupported mapping
- Weblogic Start Error: weblogic.management.DeploymentException: weblogic.management.DeploymentException:
- How to Solve TypeError: type numpy.ndarray doesn’t define __round__ method
- How to Solve TypeError: type numpy.ndarray doesn‘t define __round__ method
- How to Solve Maven Error: Failure to transfer com.thoughtworks.xstream:xstream:jar:1.3.1 from https://repo.maven.ap