orion_kid
orion_kid

Reputation: 455

Getting a Hikari Pool Initialization error

Getting this on startup in my JRE 11. No-one else in the team seems to get it. It does resolve if I compile and run in 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

etc

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)

Upvotes: 0

Views: 10547

Answers (1)

kdp008
kdp008

Reputation: 46

I had the same issue but with Java 8 as well as Java 11. I tried passing this VM argument and it worked for me:

-Doracle.jdbc.javaNetNio=false

Or, we can also set it as properties if creating an 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);

Or if creating a HikariDataSource, we can use it as:

HikariConfig poolConfig = new HikariConfig();
poolConfig.setJdbcUrl(jdbcUrl);
poolConfig.setDriverClassName(jdbcDriver);  
//...  other properties if needed
poolConfig.addDataSourceProperty("oracle.jdbc.javaNetNio", "false");

Upvotes: 3

Related Questions