Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[native-image] Error with Micronaut Data and SQL Server #1913

Closed
ilopmar opened this issue Dec 2, 2019 · 4 comments · Fixed by #6089
Closed

[native-image] Error with Micronaut Data and SQL Server #1913

ilopmar opened this issue Dec 2, 2019 · 4 comments · Fixed by #6089
Assignees

Comments

@ilopmar
Copy link

ilopmar commented Dec 2, 2019

I've tried to build a Micronaut Data native-image application with SQL Server support but it fails during the native image creation unless I add the flag --report-unsupported-elements-at-runtime (which is discouraged).

Then, it fails during execution.

Steps to reproduce the issue:

  • git clone https://github.com/micronaut-graal-tests/micronaut-data-jdbc-graal
  • cd micronaut-data-jdbc-graal
  • git checkout sqlserver
  • Use GraalVM from master branch for JDK8
  • ./build-native-image.sh

The error is:

[mn-data-jdbc-graal-sqlserver:5896]    classlist:   9,646.21 ms
[mn-data-jdbc-graal-sqlserver:5896]        (cap):     962.83 ms
[mn-data-jdbc-graal-sqlserver:5896]        setup:   3,457.54 ms
[mn-data-jdbc-graal-sqlserver:5896]   (typeflow):  48,680.26 ms
[mn-data-jdbc-graal-sqlserver:5896]    (objects):  26,933.52 ms
[mn-data-jdbc-graal-sqlserver:5896]   (features):   4,688.49 ms
[mn-data-jdbc-graal-sqlserver:5896]     analysis:  85,561.72 ms
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.util.JapaneseImperialCalendar is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
	at parsing java.util.Calendar$Builder.build(Calendar.java:1497)
Call path from entry point to java.util.Calendar$Builder.build(): 
	at java.util.Calendar$Builder.build(Calendar.java:1462)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.getMSIAuthToken(SQLServerConnection.java:4376)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.getFedAuthToken(SQLServerConnection.java:4189)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.onFedAuthInfo(SQLServerConnection.java:4158)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.processFedAuthInfo(SQLServerConnection.java:4123)
	at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onFedAuthInfo(tdsparser.java:289)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:125)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1620)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.executeBatch(SQLServerStatement.java:1810)
	at com.oracle.svm.reflect.Statement_executeBatch_ad5c04e8bff028e2eba4fdc81e56a0fabddc3502_1700.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.apache.tomcat.jdbc.pool.PoolProperties.toString(PoolProperties.java:841)
	at java.lang.String.valueOf(String.java:2994)
	at java.nio.charset.IllegalCharsetNameException.<init>(IllegalCharsetNameException.java:55)
	at java.nio.charset.Charset.checkName(Charset.java:315)
	at com.oracle.svm.core.jdk.Target_java_nio_charset_Charset.lookup(CharsetSubstitutions.java:78)
	at java.nio.charset.Charset.isSupported(Charset.java:505)
	at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_ARRAY:Ljava_nio_charset_Charset_2_0002eisSupported_00028Ljava_lang_String_2_00029Z(generated:0)

Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1

I've tried initializing a few classes at run-time/build-time but it's not working. I'm not really sure if this is a bug on GraalVM side or something with the SQL Server JDBC driver.

As mentioned before if I add --report-unsupported-elements-at-runtime I can build the native-image.
For everything to work you need to start SQL Server with:

docker run -it --rm -e 'ACCEPT_EULA=Y' -e 'SA_PASSWORD=My!Secret123' -e 'MSSQL_PID=Express' -p 1433:1433 mcr.microsoft.com/mssql/server:2017-latest-ubuntu

And then:

$ ./mn-data-jdbc-graal-sqlserver
Dec 02, 2019 1:37:10 PM org.apache.tomcat.jdbc.pool.ConnectionPool init
SEVERE: Unable to create initial connections of pool.
com.microsoft.sqlserver.jdbc.SQLServerException: SQL Server collation SQL_Latin1_General_CP1_CI_AS is not supported by this driver. ClientConnectionId:3a086b66-5507-4db0-95ed-c2f88b8bd124
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2924)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.processEnvChange(SQLServerConnection.java:3803)
	at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEnvChange(tdsparser.java:212)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:37)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:5067)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3731)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:94)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3675)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2488)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2142)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1993)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1164)
	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:760)
	at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319)
	at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:744)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:676)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154)
	at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118)
	at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107)
	at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131)
	at io.micronaut.data.jdbc.config.SchemaGenerator.createSchema(SchemaGenerator.java:87)
	at io.micronaut.data.jdbc.config.$SchemaGeneratorDefinition.initialize(Unknown Source)
	at io.micronaut.data.jdbc.config.$SchemaGeneratorDefinition.build(Unknown Source)
	at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1598)
	at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2307)
	at io.micronaut.context.DefaultBeanContext.loadContextScopeBean(DefaultBeanContext.java:1899)
	at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1262)
	at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:236)
	at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:2446)
	at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:200)
	at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:187)
	at io.micronaut.runtime.Micronaut.start(Micronaut.java:69)
	at io.micronaut.runtime.Micronaut.run(Micronaut.java:307)
	at io.micronaut.runtime.Micronaut.run(Micronaut.java:293)
	at example.Application.main(Application.java:32)
Caused by: java.io.UnsupportedEncodingException: SQL Server collation SQL_Latin1_General_CP1_CI_AS is not supported by this driver.
	at com.microsoft.sqlserver.jdbc.SQLCollation.encodingFromSortId(SQLCollation.java:531)
	at com.microsoft.sqlserver.jdbc.SQLCollation.<init>(SQLCollation.java:93)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.processEnvChange(SQLServerConnection.java:3801)
	... 38 more
Caused by: java.io.UnsupportedEncodingException: Codepage Cp1252 is not supported by the Java environment.
	at com.microsoft.sqlserver.jdbc.Encoding.checkSupported(SQLCollation.java:596)
	at com.microsoft.sqlserver.jdbc.SQLCollation$SortOrder.getEncoding(SQLCollation.java:501)
	at com.microsoft.sqlserver.jdbc.SQLCollation.encodingFromSortId(SQLCollation.java:527)
	... 40 more

13:37:10.410 [main] ERROR io.micronaut.runtime.Micronaut - Error starting Micronaut server: Bean definition [io.micronaut.data.jdbc.config.SchemaGenerator] could not be loaded: Error instantiating bean of type [io.micronaut.data.jdbc.config.SchemaGenerator]: Unable to create database schema: SQL Server collation SQL_Latin1_General_CP1_CI_AS is not supported by this driver. ClientConnectionId:3a086b66-5507-4db0-95ed-c2f88b8bd124
io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [io.micronaut.data.jdbc.config.SchemaGenerator] could not be loaded: Error instantiating bean of type [io.micronaut.data.jdbc.config.SchemaGenerator]: Unable to create database schema: SQL Server collation SQL_Latin1_General_CP1_CI_AS is not supported by this driver. ClientConnectionId:3a086b66-5507-4db0-95ed-c2f88b8bd124
	at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1264)
	at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:236)
	at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:2446)
	at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:200)
	at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:187)
	at io.micronaut.runtime.Micronaut.start(Micronaut.java:69)
	at io.micronaut.runtime.Micronaut.run(Micronaut.java:307)
	at io.micronaut.runtime.Micronaut.run(Micronaut.java:293)
	at example.Application.main(Application.java:32)
Caused by: io.micronaut.context.exceptions.BeanInstantiationException: Error instantiating bean of type [io.micronaut.data.jdbc.config.SchemaGenerator]: Unable to create database schema: SQL Server collation SQL_Latin1_General_CP1_CI_AS is not supported by this driver. ClientConnectionId:3a086b66-5507-4db0-95ed-c2f88b8bd124
	at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1626)
	at io.micronaut.context.DefaultBeanContext.createAndRegisterSingleton(DefaultBeanContext.java:2307)
	at io.micronaut.context.DefaultBeanContext.loadContextScopeBean(DefaultBeanContext.java:1899)
	at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1262)
	... 8 common frames omitted
Caused by: io.micronaut.data.exceptions.DataAccessException: Unable to create database schema: SQL Server collation SQL_Latin1_General_CP1_CI_AS is not supported by this driver. ClientConnectionId:3a086b66-5507-4db0-95ed-c2f88b8bd124
	at io.micronaut.data.jdbc.config.SchemaGenerator.createSchema(SchemaGenerator.java:161)
	at io.micronaut.data.jdbc.config.$SchemaGeneratorDefinition.initialize(Unknown Source)
	at io.micronaut.data.jdbc.config.$SchemaGeneratorDefinition.build(Unknown Source)
	at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:1598)
	... 11 common frames omitted
Caused by: com.microsoft.sqlserver.jdbc.SQLServerException: SQL Server collation SQL_Latin1_General_CP1_CI_AS is not supported by this driver. ClientConnectionId:3a086b66-5507-4db0-95ed-c2f88b8bd124
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.terminate(SQLServerConnection.java:2924)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.processEnvChange(SQLServerConnection.java:3803)
	at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onEnvChange(tdsparser.java:212)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:84)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:37)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.sendLogon(SQLServerConnection.java:5067)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.logon(SQLServerConnection.java:3731)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.access$000(SQLServerConnection.java:94)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection$LogonCommand.doExecute(SQLServerConnection.java:3675)
	at com.microsoft.sqlserver.jdbc.TDSCommand.execute(IOBuffer.java:7194)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.executeCommand(SQLServerConnection.java:2979)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectHelper(SQLServerConnection.java:2488)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.login(SQLServerConnection.java:2142)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connectInternal(SQLServerConnection.java:1993)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.connect(SQLServerConnection.java:1164)
	at com.microsoft.sqlserver.jdbc.SQLServerDriver.connect(SQLServerDriver.java:760)
	at org.apache.tomcat.jdbc.pool.PooledConnection.connectUsingDriver(PooledConnection.java:319)
	at org.apache.tomcat.jdbc.pool.PooledConnection.connect(PooledConnection.java:212)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.createConnection(ConnectionPool.java:744)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.borrowConnection(ConnectionPool.java:676)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.init(ConnectionPool.java:483)
	at org.apache.tomcat.jdbc.pool.ConnectionPool.<init>(ConnectionPool.java:154)
	at org.apache.tomcat.jdbc.pool.DataSourceProxy.pCreatePool(DataSourceProxy.java:118)
	at org.apache.tomcat.jdbc.pool.DataSourceProxy.createPool(DataSourceProxy.java:107)
	at org.apache.tomcat.jdbc.pool.DataSourceProxy.getConnection(DataSourceProxy.java:131)
	at io.micronaut.data.jdbc.config.SchemaGenerator.createSchema(SchemaGenerator.java:87)
	... 14 common frames omitted
Caused by: java.io.UnsupportedEncodingException: SQL Server collation SQL_Latin1_General_CP1_CI_AS is not supported by this driver.
	at com.microsoft.sqlserver.jdbc.SQLCollation.encodingFromSortId(SQLCollation.java:531)
	at com.microsoft.sqlserver.jdbc.SQLCollation.<init>(SQLCollation.java:93)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.processEnvChange(SQLServerConnection.java:3801)
	... 38 common frames omitted
Caused by: java.io.UnsupportedEncodingException: Codepage Cp1252 is not supported by the Java environment.
	at com.microsoft.sqlserver.jdbc.Encoding.checkSupported(SQLCollation.java:596)
	at com.microsoft.sqlserver.jdbc.SQLCollation$SortOrder.getEncoding(SQLCollation.java:501)
	at com.microsoft.sqlserver.jdbc.SQLCollation.encodingFromSortId(SQLCollation.java:527)
	... 40 common frames omitted

One final thing I've tried is using the native-image Java Agent to generate all the config files but the result is the same in both cases: unable to build the native-image without --report-unsupported-elements-at-runtime and same error at runtime with it.

@ilopmar
Copy link
Author

ilopmar commented May 27, 2020

The last error can be fixed adding -H:+AddAllCharsets. Then the application starts and works (and least for my simple tests), but the --report-unsupported-elements-at-runtime is still neccesary.

If you want to reproduce the issue, please use the branch master_sqlserver, then edit the native-image.properties and remove the --report-unsupported-elements-at-runtime flag.
When building the native image with lastest GraalVM build from master branch (ebcf391), the error is:

[mn-data-jdbc-graal-sqlserver:1006]    classlist:  10,280.86 ms,  1.89 GB
[mn-data-jdbc-graal-sqlserver:1006]        (cap):   1,267.68 ms,  1.89 GB
WARNING: Could not resolve io.netty.channel.epoll.EpollChannelOption for reflection configuration.
WARNING: Could not resolve io.netty.channel.kqueue.KQueueChannelOption for reflection configuration.
[mn-data-jdbc-graal-sqlserver:1006]        setup:   3,533.03 ms,  1.89 GB
[mn-data-jdbc-graal-sqlserver:1006]     (clinit):   2,235.43 ms,  3.99 GB
[mn-data-jdbc-graal-sqlserver:1006]   (typeflow):  58,175.18 ms,  3.99 GB
[mn-data-jdbc-graal-sqlserver:1006]    (objects):  36,211.87 ms,  3.99 GB
[mn-data-jdbc-graal-sqlserver:1006]   (features):   4,886.12 ms,  3.99 GB
[mn-data-jdbc-graal-sqlserver:1006]     analysis: 108,834.88 ms,  3.99 GB
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.util.JapaneseImperialCalendar is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
	at parsing java.util.Calendar$Builder.build(Calendar.java:1497)
Call path from entry point to java.util.Calendar$Builder.build(): 
	at java.util.Calendar$Builder.build(Calendar.java:1462)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.getMSIAuthToken(SQLServerConnection.java:4376)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.getFedAuthToken(SQLServerConnection.java:4189)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.onFedAuthInfo(SQLServerConnection.java:4158)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.processFedAuthInfo(SQLServerConnection.java:4123)
	at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onFedAuthInfo(tdsparser.java:289)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:125)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1620)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMoreResults(SQLServerStatement.java:1344)
	at com.oracle.svm.reflect.Statement_getMoreResults_bf04cb65816f18d7bf5b96759b43717daf39e2f1_1119.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at javax.xml.transform.TransformerException.printStackTrace(TransformerException.java:348)
	at javax.xml.transform.TransformerException.printStackTrace(TransformerException.java:282)
	at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:768)
	at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)

com.oracle.svm.core.util.UserError$UserException: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.util.JapaneseImperialCalendar is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
	at parsing java.util.Calendar$Builder.build(Calendar.java:1497)
Call path from entry point to java.util.Calendar$Builder.build(): 
	at java.util.Calendar$Builder.build(Calendar.java:1462)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.getMSIAuthToken(SQLServerConnection.java:4376)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.getFedAuthToken(SQLServerConnection.java:4189)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.onFedAuthInfo(SQLServerConnection.java:4158)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.processFedAuthInfo(SQLServerConnection.java:4123)
	at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onFedAuthInfo(tdsparser.java:289)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:125)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1620)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMoreResults(SQLServerStatement.java:1344)
	at com.oracle.svm.reflect.Statement_getMoreResults_bf04cb65816f18d7bf5b96759b43717daf39e2f1_1119.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at javax.xml.transform.TransformerException.printStackTrace(TransformerException.java:348)
	at javax.xml.transform.TransformerException.printStackTrace(TransformerException.java:282)
	at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:768)
	at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)

	at com.oracle.svm.core.util.UserError.abort(UserError.java:79)
	at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:217)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:754)
	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:541)
	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:454)
	at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
	at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
	at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
	at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
	at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.util.JapaneseImperialCalendar is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Detailed message:
Trace: 
	at parsing java.util.Calendar$Builder.build(Calendar.java:1497)
Call path from entry point to java.util.Calendar$Builder.build(): 
	at java.util.Calendar$Builder.build(Calendar.java:1462)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.getMSIAuthToken(SQLServerConnection.java:4376)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.getFedAuthToken(SQLServerConnection.java:4189)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.onFedAuthInfo(SQLServerConnection.java:4158)
	at com.microsoft.sqlserver.jdbc.SQLServerConnection.processFedAuthInfo(SQLServerConnection.java:4123)
	at com.microsoft.sqlserver.jdbc.TDSTokenHandler.onFedAuthInfo(tdsparser.java:289)
	at com.microsoft.sqlserver.jdbc.TDSParser.parse(tdsparser.java:125)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getNextResult(SQLServerStatement.java:1620)
	at com.microsoft.sqlserver.jdbc.SQLServerStatement.getMoreResults(SQLServerStatement.java:1344)
	at com.oracle.svm.reflect.Statement_getMoreResults_bf04cb65816f18d7bf5b96759b43717daf39e2f1_1119.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at javax.xml.transform.TransformerException.printStackTrace(TransformerException.java:348)
	at javax.xml.transform.TransformerException.printStackTrace(TransformerException.java:282)
	at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:768)
	at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)

	at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:751)
	... 7 more
Caused by: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.util.JapaneseImperialCalendar is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
	at com.oracle.svm.hosted.substitute.AnnotationSubstitutionProcessor.lookup(AnnotationSubstitutionProcessor.java:115)
	at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:113)
	at com.oracle.graal.pointsto.infrastructure.SubstitutionProcessor$ChainedSubstitutionProcessor.lookup(SubstitutionProcessor.java:113)
	at com.oracle.graal.pointsto.meta.AnalysisUniverse.lookupAllowUnresolved(AnalysisUniverse.java:205)
	at com.oracle.graal.pointsto.infrastructure.WrappedConstantPool.lookupType(WrappedConstantPool.java:155)
	at org.graalvm.compiler.java.BytecodeParser.lookupType(BytecodeParser.java:4262)
	at org.graalvm.compiler.java.BytecodeParser.genNewInstance(BytecodeParser.java:4533)
	at org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5331)
	at org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3411)
	at org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3218)
	at org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1088)
	at org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:982)
	at org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:74)
	at org.graalvm.compiler.phases.Phase.run(Phase.java:49)
	at org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:214)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
	at org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.parse(MethodTypeFlowBuilder.java:223)
	at com.oracle.graal.pointsto.flow.MethodTypeFlowBuilder.apply(MethodTypeFlowBuilder.java:357)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.doParse(MethodTypeFlow.java:313)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.ensureParsed(MethodTypeFlow.java:302)
	at com.oracle.graal.pointsto.flow.MethodTypeFlow.addContext(MethodTypeFlow.java:103)
	at com.oracle.graal.pointsto.DefaultAnalysisPolicy$DefaultVirtualInvokeTypeFlow.onObservedUpdate(DefaultAnalysisPolicy.java:228)
	at com.oracle.graal.pointsto.flow.TypeFlow.notifyObservers(TypeFlow.java:470)
	at com.oracle.graal.pointsto.flow.TypeFlow.update(TypeFlow.java:542)
	at com.oracle.graal.pointsto.BigBang$2.run(BigBang.java:544)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$execute$0(CompletionExecutor.java:173)
	at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402)
	... 4 more
Error: Image build request failed with exit status 1

@peterscardera
Copy link

I get the exact same error as above.

Using:
Micronaut 3.1.0
'com.microsoft.sqlserver:mssql-jdbc:9.4.0.jre11'
'org.jetbrains.exposed:exposed-core:0.35.1'
'org.jetbrains.exposed:exposed-jdbc:0.35.1'
'org.jetbrains.exposed:exposed-java-time:0.35.1'
'org.jetbrains.exposed:exposed-dao:0.35.1'

Adding '-H:AddAllCharsets' unfortunately does not seem to work.

Only adding '--report-unsupported-elements-at-runtime', ' --allow-incomplete-classpath' as arguments work for me which I'd like to avoid if possible

@ilopmar
Copy link
Author

ilopmar commented Oct 27, 2021

@peterscardera You don't need to add --allow-incomplete-classpath yourself, Micronaut already does that and it's mandatory for Micronaut to work with GraalVM. This is because we have @Requires(...) all over the place in Micronaut and those requirement can be on a class that may not be present on the classpath.

Regarding --report-unsupported-elements-at-runtime, I'm afraid it's still necessary (I've just tried), and that's why I opened this issue in the first place.

@fniephaus
Copy link
Member

I have addressed this in #6089 and --report-unsupported-elements-at-runtime should no longer be needed. Please feel free to verify that this is the case using a dev build in a couple of hours.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants