Please make HikariCP GraalVM native image ready by providing native image configuration like reflect-config-json out of the box.
It takes too much time to figure it our on its own.
- For example, see tmy sample project reflect.json where I had to add:
{
"name" : "software.amazonaws.example.product.dao.PoolEntry",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name": "java.sql.Statement[]",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name": "com.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry[]",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
}
because; for example,
public FastList(Class<?> clazz)
{
this.elementData = (T[]) Array.newInstance(clazz, 32);
this.clazz = clazz;
}
isn't understood by native image and (T[]) Array.newInstance(clazz, 32); leads ro Nullpointer exception, because the class Statement which array will be instatiated in the PoolEntry class
PoolEntry(final Connection connection, final PoolBase pool, final boolean isReadOnly, final boolean isAutoCommit)
{
....
this.openStatements = new FastList<>(Statement.class, 16);
}
isn't loaded at the runtime.
Please make HikariCP GraalVM native image ready by providing native image configuration like reflect-config-json out of the box.
It takes too much time to figure it our on its own.
{
"name" : "software.amazonaws.example.product.dao.PoolEntry",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name": "java.sql.Statement[]",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
},
{
"name": "com.zaxxer.hikari.util.ConcurrentBag$IConcurrentBagEntry[]",
"allDeclaredConstructors" : true,
"allPublicConstructors" : true,
"allDeclaredMethods" : true,
"allPublicMethods" : true,
"allDeclaredClasses" : true,
"allPublicClasses" : true
}
because; for example,
public FastList(Class<?> clazz)
{
this.elementData = (T[]) Array.newInstance(clazz, 32);
this.clazz = clazz;
}
isn't understood by native image and (T[]) Array.newInstance(clazz, 32); leads ro Nullpointer exception, because the class Statement which array will be instatiated in the PoolEntry class
PoolEntry(final Connection connection, final PoolBase pool, final boolean isReadOnly, final boolean isAutoCommit)
{
....
this.openStatements = new FastList<>(Statement.class, 16);
}
isn't loaded at the runtime.