How can I resolve the issue of not being able to register the SftpPool MBean?

摘要:https:www.cnblogs.comvipsoftp17272728.html org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to
https://www.cnblogs.com/vipsoft/p/17272728.html org.springframework.jmx.export.UnableToRegisterMBeanException: Unable to register MBean [SftpPool [maxTotal=8, blockWhenExhausted=true, maxWaitMillis=-1, lifo=true, fairness=false, testOnCreate=false, testOnBorrow=false, testOnReturn=false, testWhileIdle=false, timeBetweenEvictionRunsMillis=-1, numTestsPerEvictionRun=3, minEvictableIdleTimeMillis=1800000, softMinEvictableIdleTimeMillis=-1, evictionPolicy=org.apache.commons.pool2.impl.DefaultEvictionPolicy@131c0b6f, closeLock=java.lang.Object@7f030c72, closed=false, evictionLock=java.lang.Object@68d8ae27, evictor=null, evictionIterator=null, factoryClassLoader=java.lang.ref.WeakReference@18513c23, oname=org.apache.commons.pool2:type=GenericObjectPool,name=pool, creationStackTrace=java.lang.Exception at org.apache.commons.pool2.impl.BaseGenericObjectPool.<init>(BaseGenericObjectPool.java:147) at org.apache.commons.pool2.impl.GenericObjectPool.<init>(GenericObjectPool.java:110) at com.vipsoft.his.hospital.util.SftpPool.<init>(SftpPool.java:9) at com.vipsoft.his.hospital.config.SftpConfig.sftpPool(SftpConfig.java:22) SftConfig 修改如下: @Configuration @EnableConfigurationProperties(SftpProperties.class) public class SftpConfig { // 工厂 @Bean public SftpFactory sftpFactory(SftpProperties properties) { return new SftpFactory(properties); } // 连接池 @Bean public SftpPool sftpPool(SftpFactory sftpFactory) { GenericObjectPoolConfig poolConfig = sftpFactory.getProperties().getPool(); poolConfig.setJmxEnabled(false); return new SftpPool(sftpFactory); } // 辅助类 @Bean public SftpUtil sftpUtil(SftpPool sftpPool) { return new SftpUtil(sftpPool); } }