quarkus-jooq icon indicating copy to clipboard operation
quarkus-jooq copied to clipboard

Doesn't compile in native mode with GraalVM 22.1

Open luneo7 opened this issue 2 years ago • 4 comments

GraalVM 22.1 introduced --link-at-build-time and Quarkus 2.9.2.Final enforces its use unless you use the dreprecated NativeImageAllowIncompleteClasspathBuildItem to disable that feature.

jOOQ has incomplete class path (optional dependencies) that causes the build to fail if linked at build time, we should either add a NativeImageAllowIncompleteClasspathBuildItem so we can do native image with jOOQ, and/or fix jOOQ upstream so DB utils are in a separated lib that needs to be imported if using the desired DB.

This is the stack trace of trying to build jOOQ in GraalVM 22.1

Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:242)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toPGInterval(YearToMonth): 
        at org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:242)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.sqlInline0(DefaultBinding.java:4770)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.sqlInline0(DefaultBinding.java:4751)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:887)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:879)
        at org.jooq.impl.Val.accept(Val.java:182)
        at org.jooq.impl.DefaultRenderContext.visit0(DefaultRenderContext.java:720)
        at org.jooq.impl.AbstractContext.visit(AbstractContext.java:264)
        at org.jooq.impl.DefaultDSLContext.renderInlined(DefaultDSLContext.java:724)
        at org.jooq.impl.AbstractQueryPart.toString(AbstractQueryPart.java:196)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:227)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toPGInterval(YearToSecond): 
        at org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:227)
        at org.jooq.impl.DefaultBinding$DefaultYearToSecondBinding.sqlInline0(DefaultBinding.java:4689)
        at org.jooq.impl.DefaultBinding$DefaultYearToSecondBinding.sqlInline0(DefaultBinding.java:4671)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:887)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:879)
        at org.jooq.impl.Val.accept(Val.java:182)
        at org.jooq.impl.DefaultRenderContext.visit0(DefaultRenderContext.java:720)
        at org.jooq.impl.AbstractContext.visit(AbstractContext.java:264)
        at org.jooq.impl.DefaultDSLContext.renderInlined(DefaultDSLContext.java:724)
        at org.jooq.impl.AbstractQueryPart.toString(AbstractQueryPart.java:196)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toYearToMonth(PostgresUtils.java:351)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toYearToMonth(Object): 
        at org.jooq.util.postgres.PostgresUtils.toYearToMonth(PostgresUtils.java:349)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.get0(DefaultBinding.java:4800)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.get0(DefaultBinding.java:4751)
        at org.jooq.impl.DefaultBinding$AbstractBinding.get(DefaultBinding.java:947)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.setValue(CursorImpl.java:1558)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1507)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1466)
        at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:143)
        at org.jooq.impl.CursorImpl$CursorIterator.fetchNext(CursorImpl.java:1431)
        at org.jooq.impl.CursorImpl$CursorIterator.hasNext(CursorImpl.java:1407)
        at java.util.AbstractMap.toString(AbstractMap.java:545)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)

com.oracle.svm.core.util.UserError$UserException: Unsupported features in 5 methods
Detailed message:
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toDayToSecond(PostgresUtils.java:301)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toDayToSecond(Object): 
        at org.jooq.util.postgres.PostgresUtils.toDayToSecond(PostgresUtils.java:299)
        at org.jooq.impl.DefaultBinding$DefaultDayToSecondBinding.get0(DefaultBinding.java:2317)
        at org.jooq.impl.DefaultBinding$DefaultDayToSecondBinding.get0(DefaultBinding.java:2268)
        at org.jooq.impl.DefaultBinding$AbstractBinding.get(DefaultBinding.java:947)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.setValue(CursorImpl.java:1558)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1507)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1466)
        at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:143)
        at org.jooq.impl.CursorImpl$CursorIterator.fetchNext(CursorImpl.java:1431)
        at org.jooq.impl.CursorImpl$CursorIterator.hasNext(CursorImpl.java:1407)
        at java.util.AbstractMap.toString(AbstractMap.java:545)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:214)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toPGInterval(DayToSecond): 
        at org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:214)
        at org.jooq.impl.DefaultBinding$DefaultDayToSecondBinding.sqlInline0(DefaultBinding.java:2287)
        at org.jooq.impl.DefaultBinding$DefaultDayToSecondBinding.sqlInline0(DefaultBinding.java:2268)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:887)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:879)
        at org.jooq.impl.Val.accept(Val.java:182)
        at org.jooq.impl.DefaultRenderContext.visit0(DefaultRenderContext.java:720)
        at org.jooq.impl.AbstractContext.visit(AbstractContext.java:264)
        at org.jooq.impl.DefaultDSLContext.renderInlined(DefaultDSLContext.java:724)
        at org.jooq.impl.AbstractQueryPart.toString(AbstractQueryPart.java:196)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:242)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toPGInterval(YearToMonth): 
        at org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:242)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.sqlInline0(DefaultBinding.java:4770)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.sqlInline0(DefaultBinding.java:4751)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:887)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:879)
        at org.jooq.impl.Val.accept(Val.java:182)
        at org.jooq.impl.DefaultRenderContext.visit0(DefaultRenderContext.java:720)
        at org.jooq.impl.AbstractContext.visit(AbstractContext.java:264)
        at org.jooq.impl.DefaultDSLContext.renderInlined(DefaultDSLContext.java:724)
        at org.jooq.impl.AbstractQueryPart.toString(AbstractQueryPart.java:196)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:227)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toPGInterval(YearToSecond): 
        at org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:227)
        at org.jooq.impl.DefaultBinding$DefaultYearToSecondBinding.sqlInline0(DefaultBinding.java:4689)
        at org.jooq.impl.DefaultBinding$DefaultYearToSecondBinding.sqlInline0(DefaultBinding.java:4671)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:887)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:879)
        at org.jooq.impl.Val.accept(Val.java:182)
        at org.jooq.impl.DefaultRenderContext.visit0(DefaultRenderContext.java:720)
        at org.jooq.impl.AbstractContext.visit(AbstractContext.java:264)
        at org.jooq.impl.DefaultDSLContext.renderInlined(DefaultDSLContext.java:724)
        at org.jooq.impl.AbstractQueryPart.toString(AbstractQueryPart.java:196)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toYearToMonth(PostgresUtils.java:351)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toYearToMonth(Object): 
        at org.jooq.util.postgres.PostgresUtils.toYearToMonth(PostgresUtils.java:349)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.get0(DefaultBinding.java:4800)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.get0(DefaultBinding.java:4751)
        at org.jooq.impl.DefaultBinding$AbstractBinding.get(DefaultBinding.java:947)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.setValue(CursorImpl.java:1558)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1507)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1466)
        at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:143)
        at org.jooq.impl.CursorImpl$CursorIterator.fetchNext(CursorImpl.java:1431)
        at org.jooq.impl.CursorImpl$CursorIterator.hasNext(CursorImpl.java:1407)
        at java.util.AbstractMap.toString(AbstractMap.java:545)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)

        at com.oracle.svm.core.util.UserError.abort(UserError.java:84)
        at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:249)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:754)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:558)
        at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:515)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:407)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:585)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:128)
        at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:615)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Unsupported features in 5 methods
Detailed message:
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toDayToSecond(PostgresUtils.java:301)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toDayToSecond(Object): 
        at org.jooq.util.postgres.PostgresUtils.toDayToSecond(PostgresUtils.java:299)
        at org.jooq.impl.DefaultBinding$DefaultDayToSecondBinding.get0(DefaultBinding.java:2317)
        at org.jooq.impl.DefaultBinding$DefaultDayToSecondBinding.get0(DefaultBinding.java:2268)
        at org.jooq.impl.DefaultBinding$AbstractBinding.get(DefaultBinding.java:947)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.setValue(CursorImpl.java:1558)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1507)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1466)
        at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:143)
        at org.jooq.impl.CursorImpl$CursorIterator.fetchNext(CursorImpl.java:1431)
        at org.jooq.impl.CursorImpl$CursorIterator.hasNext(CursorImpl.java:1407)
        at java.util.AbstractMap.toString(AbstractMap.java:545)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:214)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toPGInterval(DayToSecond): 
        at org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:214)
        at org.jooq.impl.DefaultBinding$DefaultDayToSecondBinding.sqlInline0(DefaultBinding.java:2287)
        at org.jooq.impl.DefaultBinding$DefaultDayToSecondBinding.sqlInline0(DefaultBinding.java:2268)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:887)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:879)
        at org.jooq.impl.Val.accept(Val.java:182)
        at org.jooq.impl.DefaultRenderContext.visit0(DefaultRenderContext.java:720)
        at org.jooq.impl.AbstractContext.visit(AbstractContext.java:264)
        at org.jooq.impl.DefaultDSLContext.renderInlined(DefaultDSLContext.java:724)
        at org.jooq.impl.AbstractQueryPart.toString(AbstractQueryPart.java:196)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:242)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toPGInterval(YearToMonth): 
        at org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:242)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.sqlInline0(DefaultBinding.java:4770)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.sqlInline0(DefaultBinding.java:4751)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:887)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:879)
        at org.jooq.impl.Val.accept(Val.java:182)
        at org.jooq.impl.DefaultRenderContext.visit0(DefaultRenderContext.java:720)
        at org.jooq.impl.AbstractContext.visit(AbstractContext.java:264)
        at org.jooq.impl.DefaultDSLContext.renderInlined(DefaultDSLContext.java:724)
        at org.jooq.impl.AbstractQueryPart.toString(AbstractQueryPart.java:196)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:227)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toPGInterval(YearToSecond): 
        at org.jooq.util.postgres.PostgresUtils.toPGInterval(PostgresUtils.java:227)
        at org.jooq.impl.DefaultBinding$DefaultYearToSecondBinding.sqlInline0(DefaultBinding.java:4689)
        at org.jooq.impl.DefaultBinding$DefaultYearToSecondBinding.sqlInline0(DefaultBinding.java:4671)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:887)
        at org.jooq.impl.DefaultBinding$AbstractBinding.sql(DefaultBinding.java:879)
        at org.jooq.impl.Val.accept(Val.java:182)
        at org.jooq.impl.DefaultRenderContext.visit0(DefaultRenderContext.java:720)
        at org.jooq.impl.AbstractContext.visit(AbstractContext.java:264)
        at org.jooq.impl.DefaultDSLContext.renderInlined(DefaultDSLContext.java:724)
        at org.jooq.impl.AbstractQueryPart.toString(AbstractQueryPart.java:196)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.graal.pointsto.constraints.UnresolvedElementException: Discovered unresolved type during parsing: org.postgresql.util.PGInterval. This error is reported at image build time because class org.jooq.util.postgres.PostgresUtils is registered for linking at image build time by command line
Trace: 
        at parsing org.jooq.util.postgres.PostgresUtils.toYearToMonth(PostgresUtils.java:351)
Call path from entry point to org.jooq.util.postgres.PostgresUtils.toYearToMonth(Object): 
        at org.jooq.util.postgres.PostgresUtils.toYearToMonth(PostgresUtils.java:349)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.get0(DefaultBinding.java:4800)
        at org.jooq.impl.DefaultBinding$DefaultYearToMonthBinding.get0(DefaultBinding.java:4751)
        at org.jooq.impl.DefaultBinding$AbstractBinding.get(DefaultBinding.java:947)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.setValue(CursorImpl.java:1558)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1507)
        at org.jooq.impl.CursorImpl$CursorIterator$CursorRecordInitialiser.apply(CursorImpl.java:1466)
        at org.jooq.impl.RecordDelegate.operate(RecordDelegate.java:143)
        at org.jooq.impl.CursorImpl$CursorIterator.fetchNext(CursorImpl.java:1431)
        at org.jooq.impl.CursorImpl$CursorIterator.hasNext(CursorImpl.java:1407)
        at java.util.AbstractMap.toString(AbstractMap.java:545)
        at java.lang.String.valueOf(String.java:2951)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:848)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)

        at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:129)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:751)
        ... 6 more

luneo7 avatar May 30 '22 17:05 luneo7

and/or fix jOOQ upstream so DB utils are in a separated lib that needs to be imported if using the desired DB.

Regarding this particular problem, the dependency on pgjdbc has been removed again in jOOQ 3.17 via shading of this particular class, see https://github.com/jOOQ/jOOQ/issues/13053

Obviously, preventing such issues by building jOOQ for GraalVM as well would be better. It will happen in the future, not sure when: https://github.com/jOOQ/jOOQ/issues/8779

lukaseder avatar May 31 '22 08:05 lukaseder

we should either add a NativeImageAllowIncompleteClasspathBuildItem so we can do native image with jOOQ

Another way would be to include substitutions in the jOOQ extension that will explicitly make the optional dependencies unreachable.

and/or fix jOOQ upstream so DB utils are in a separated lib that needs to be imported if using the desired DB.

That would be the best things to do.

zakkak avatar Jun 20 '22 14:06 zakkak

@lukaseder found another issue when trying to use jOOQ 3.16.x that uses Jakarta... Jakarta is listed as provided, but the references are there... for instance in checks if Jakarta is present by using an imported class instead of using a string as class name... and there are other places... if Jakarta is required, it shouldn't be listed as provided in the pom... or the code should be refactored... if doing graalvm substitution for this one, will have to create a large one

luneo7 avatar Jun 21 '22 19:06 luneo7

@luneo7 from the specs: https://maven.apache.org/guides/introduction/introduction-to-dependency-mechanism.html

provided This is much like compile, but indicates you expect the JDK or a container to provide the dependency at runtime. For example, when building a web application for the Java Enterprise Edition, you would set the dependency on the Servlet API and related Java EE APIs to scope provided because the web container provides those classes. A dependency with this scope is added to the classpath used for compilation and test, but not the runtime classpath. It is not transitive.

Seems like we're doing everything right.

lukaseder avatar Jun 23 '22 08:06 lukaseder