在我的 JRE 11 中启动时得到这个。团队中的其他人似乎没有得到它。如果我在 JDK 8 中编译并运行它确实可以解决。
HikariPool-1 - Exception during pool initialization
java.nio.BufferOverflowException: null
at java.base/java.nio.HeapByteBuffer.put(HeapByteBuffer.java:221)
at java.base/java.nio.ByteBuffer.put(ByteBuffer.java:978)
at oracle.net.ano.AnoCommNIO.d(Unknown Source
等等
2021-09-22 12:13:23.280 WARN [amp-optimizer-services,,] 29760 --- [-172.28.233.166] o.s.b.a.jdbc.DataSourceHealthIndicator : DataSource health check failed
com.zaxxer.hikari.pool.HikariPool$PoolInitializationException: Failed to initialize pool: null
at com.zaxxer.hikari.pool.HikariPool.throwPoolInitializationException(HikariPool.java:595)
at com.zaxxer.hikari.pool.HikariPool.checkFailFast(HikariPool.java:581)
at com.zaxxer.hikari.pool.HikariPool.<init>(HikariPool.java:115)
我也遇到了同样的问题,但是使用的是 Java 8 和 Java 11。我尝试传递这个 VM 参数,它对我有用:
-Doracle.jdbc.javaNetNio=false
或者,如果创建 OracleDataSource,我们也可以将其设置为属性:
OracleDataSource oracleDataSource = new OracleDataSource();
oracleDataSource.setURL(jdbcUrl);
oracleDataSource.setDriverType(dbDriver);
Properties properties = new Properties();
//... other properties if needed
properties.setProperty("oracle.jdbc.javaNetNio", "false");
oracleDataSource.setConnectionProperties(properties);
或者如果创建 HikariDataSource,我们可以将其用作:
HikariConfig poolConfig = new HikariConfig();
poolConfig.setJdbcUrl(jdbcUrl);
poolConfig.setDriverClassName(jdbcDriver);
//... other properties if needed
poolConfig.addDataSourceProperty("oracle.jdbc.javaNetNio", "false");
谢谢!它对我有用!它节省了我的时间!