mirror of
https://gitee.com/dromara/hutool.git
synced 2025-05-04 12:47:59 +08:00
修复NoSuchMethodError未捕获问题
This commit is contained in:
parent
50c07dd4d8
commit
dc5992b139
@ -154,34 +154,34 @@ public abstract class DSFactory implements Closeable, Serializable{
|
|||||||
private static DSFactory doCreate(Setting setting) {
|
private static DSFactory doCreate(Setting setting) {
|
||||||
try {
|
try {
|
||||||
return new HikariDSFactory(setting);
|
return new HikariDSFactory(setting);
|
||||||
} catch (NoClassDefFoundError e) {
|
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new DruidDSFactory(setting);
|
return new DruidDSFactory(setting);
|
||||||
} catch (NoClassDefFoundError e) {
|
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new TomcatDSFactory(setting);
|
return new TomcatDSFactory(setting);
|
||||||
} catch (NoClassDefFoundError e) {
|
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||||
//如果未引入包,此处会报org.apache.tomcat.jdbc.pool.PoolConfiguration未找到错误
|
//如果未引入包,此处会报org.apache.tomcat.jdbc.pool.PoolConfiguration未找到错误
|
||||||
//因为org.apache.tomcat.jdbc.pool.DataSource实现了此接口,会首先检查接口的存在与否
|
//因为org.apache.tomcat.jdbc.pool.DataSource实现了此接口,会首先检查接口的存在与否
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new BeeDSFactory(setting);
|
return new BeeDSFactory(setting);
|
||||||
} catch (NoClassDefFoundError e) {
|
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new DbcpDSFactory(setting);
|
return new DbcpDSFactory(setting);
|
||||||
} catch (NoClassDefFoundError e) {
|
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return new C3p0DSFactory(setting);
|
return new C3p0DSFactory(setting);
|
||||||
} catch (NoClassDefFoundError e) {
|
} catch (NoClassDefFoundError | NoSuchMethodError e) {
|
||||||
// ignore
|
// ignore
|
||||||
}
|
}
|
||||||
return new PooledDSFactory(setting);
|
return new PooledDSFactory(setting);
|
||||||
|
@ -20,7 +20,7 @@ public class PoiChecker {
|
|||||||
public static void checkPoiImport() {
|
public static void checkPoiImport() {
|
||||||
try {
|
try {
|
||||||
Class.forName("org.apache.poi.ss.usermodel.Workbook", false, ClassLoaderUtil.getClassLoader());
|
Class.forName("org.apache.poi.ss.usermodel.Workbook", false, ClassLoaderUtil.getClassLoader());
|
||||||
} catch (ClassNotFoundException | NoClassDefFoundError e) {
|
} catch (ClassNotFoundException | NoClassDefFoundError | NoSuchMethodError e) {
|
||||||
throw new DependencyException(e, NO_POI_ERROR_MSG);
|
throw new DependencyException(e, NO_POI_ERROR_MSG);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user