Skip to content

Make HikariCP GraalVM native image ready #2389

Description

@Vadym79

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.

  1. 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions