com.alibaba.druid:type=DruidDataSourceStat报错

参考博客原文如下:

项目中使用druid对数据库连接池进行管理,在本地及测试环境均无问题,但是上了生产环境后,每当tomcat第一次启动时,日志未报错,但是页面总是出不来,在关闭tomcat时,看日志,发现报错如下:
ERROR [com.alibaba.druid.stat.DruidDataSourceStatManager] – unregister mbean error
javax.management.InstanceNotFoundException: com.alibaba.druid:type=DruidDataSourceStat
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.getMBean………


网上找了各种方法,但都说的有些模糊,经过多次测试,终于解决,方法如下:
修改tomcat的bin目录下的catalina.sh文件,在# OS specific support.  $var _must_ be set to either true or false.与cygwin=false之间加上
JAVA_OPTS="-Ddruid.registerToSysProperty=true"即可

参考博客:http://blog.csdn.net/chengsi101/article/details/72627062

下面是我的catalina.sh的配置,大概在103行


配置后,依然报错。


下面是我另一篇博客:http://blog.csdn.net/h996666/article/details/78770214

偶然的也算必然的解决了这个bug

猜你喜欢

转载自blog.csdn.net/h996666/article/details/78771625