当前位置: 首页 > 知识库问答 >
问题:

PrestoDB JDBC GraalVM本机模式构建失败,只有在本机模式下运行时,查询才会引发异常

赖杰
2023-03-14

如果我想构建我的Quarkus2.7.3。在本机模式下使用GraalVM CE22.0.0.2的最终应用程序,我会得到一个由PrestoDB JDBC驱动程序引起的构建错误。

此外,当我在PrestoDB 0.270上进行SQL查询时,会出现以下异常,并且只有在本机模式下运行应用程序时才会发生
在Quarkus JVM模式下,查询工作正常。

码头建造图片:码头。io/quarkus/ubi quarkus本机映像:22.0.0-java17

我使用的是JDBC驱动程序com。脸谱网。presto:presto jdbc:0.270,带有自定义农业连接和驱动程序类com。脸谱网。急板地。jdbc。PrestoDriver

GraalVM构建错误:

/opt/graalvm/bin/native-image -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=3 -J-Duser.language=en -J-Duser.country=US -J-Dfile.encoding=UTF-8 -H:-ParseOnce -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -J--enable-preview --initialize-at-run-time=oracle.xml.util.UnicodeUtil --trace-object-instantiation=java.security.SecureRandom -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -J-Djava.awt.headless=true -H:FallbackThreshold=0 --allow-incomplete-classpath -H:+ReportExceptionStackTraces -J-Xmx8g -H:+AddAllCharsets -H:EnableURLProtocols=http,https -H:NativeLinkerOption=-no-pie -H:+AllowVMInspection -H:-UseServiceLoaderFeature -H:+StackTrace -H:DashboardDump=api-4.3.17_dashboard.dump -H:+DashboardAll --exclude-config .*com\.oracle\.database\.jdbc.* /META-INF/native-image/(?:native-image\.properties|reflect-config\.json) api-4.3.17-runner -jar api-4.3.17-runner.jar
========================================================================================================================
GraalVM Native Image: Generating 'api-4.3.17-runner'...
========================================================================================================================
[1/7] Initializing...                                                                                   (10.7s @ 0.24GB)
# Printing Dashboard BGV dump header to: /code/build/api-4.3.17-native-image-source-jar/api-4.3.17_dashboard.dump.bgv
 Version info: 'GraalVM 22.0.0.2 Java 17 CE'
 4 user-provided feature(s)
  - com.oracle.svm.thirdparty.gson.GsonFeature
  - io.quarkus.runner.AutoFeature
  - io.quarkus.runtime.graal.ResourcesFeature
  - oracle.nativeimage.NativeImageFeature
The bundle named: com/sun/rowset/RowSetResourceBundle, has not been found. If the bundle is part of a module, verify the bundle name is a fully qualified class name. Otherwise verify the bundle path is accessible in the classpath.
[2/7] Performing analysis...  [**********]                                                             (159.1s @ 3.41GB)
10:27:46,716 INFO  [org.jbo.threads] JBoss Threads version 3.4.2.Final
  28,036 (96.99%) of 28,905 classes reachable
  45,951 (70.09%) of 65,556 fields reachable
 163,540 (83.39%) of 196,125 methods reachable
     865 classes, 2,527 fields, and 13,784 methods registered for reflection
      71 classes,    98 fields, and    56 methods registered for JNI access
# Printing Dashboard PointsTo analysis BGV dump to: /code/build/api-4.3.17-native-image-source-jar/api-4.3.17_dashboard.dump.bgv
Print of Dashboard dump output ended.

Error: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  Object has been initialized by the com.facebook.presto.jdbc.PrestoDriver class initializer with a trace: 
    at java.security.SecureRandom.<init>(SecureRandom.java:224)
    at sun.security.ssl.SSLContextImpl.engineInit(SSLContextImpl.java:103)
    at javax.net.ssl.SSLContext.init(SSLContext.java:314)
    at com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient.systemDefaultSslSocketFactory(OkHttpClient.java:299)
    at com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient.<init>(OkHttpClient.java:253)
    at com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:919)
    at com.facebook.presto.jdbc.PrestoDriver.<init>(PrestoDriver.java:48)
    at com.facebook.presto.jdbc.PrestoDriver.<clinit>(PrestoDriver.java:65)
. Try avoiding to initialize the class that caused initialization of the object. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace: Object was reached by 
    reading field sun.security.ssl.SSLContextImpl.secureRandom of
        constant sun.security.ssl.SSLContextImpl$TLSContext@44080492 reached by 
    reading field sun.security.ssl.SSLSocketFactoryImpl.context of
        constant sun.security.ssl.SSLSocketFactoryImpl@36d3ab49 reached by 
    reading field com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient.sslSocketFactory of
        constant com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient@49ecd0c8 reached by 
    reading field com.facebook.presto.jdbc.PrestoDriver.httpClient of
        constant com.facebook.presto.jdbc.PrestoDriver@6d0a2e53 reached by 
    reading field java.sql.DriverInfo.driver of
        constant java.sql.DriverInfo@6fdaa47 reached by 
    indexing into array
        constant java.lang.Object[]@d8e2fa6 reached by 
    reading field java.util.concurrent.CopyOnWriteArrayList.array of
        constant java.util.concurrent.CopyOnWriteArrayList@7ff98a2e reached by 
    scanning method java.sql.DriverManager.getDriver(DriverManager.java:278)
------------------------------------------------------------------------------------------------------------------------
                       28.5s (13.8% of total time) in 67 GCs | Peak RSS: 6.86GB | CPU load: 3.36
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /code/build/api-4.3.17-native-image-source-jar/api-4.3.17-runner.build_artifacts.txt
========================================================================================================================
Failed generating 'api-4.3.17-runner' after 3m 25s.
Call path from entry point to java.sql.DriverManager.getDriver(String): 
    at java.sql.DriverManager.getDriver(DriverManager.java:270)
    at io.agroal.pool.ConnectionFactory.newDriver(ConnectionFactory.java:112)
    at io.agroal.pool.ConnectionFactory.<init>(ConnectionFactory.java:68)
    at io.agroal.pool.Poolless.<init>(Poolless.java:86)
    at io.agroal.pool.DataSource.<init>(DataSource.java:35)
    at io.quarkus.agroal.runtime.DataSources.doCreateDataSource(DataSources.java:192)
    at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:112)
    at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:109)
    at sun.security.ec.ParametersMap$1.get(ParametersMap.java:78)
    at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:216)
    at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:169)
    at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:318)
    at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VARARGS_System_getProperty_deeeaa72a006d330408a3b7d002c7533e108bc28(generated:0)

com.oracle.svm.core.util.UserError$UserException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  Object has been initialized by the com.facebook.presto.jdbc.PrestoDriver class initializer with a trace: 
    at java.security.SecureRandom.<init>(SecureRandom.java:224)
    at sun.security.ssl.SSLContextImpl.engineInit(SSLContextImpl.java:103)
    at javax.net.ssl.SSLContext.init(SSLContext.java:314)
    at com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient.systemDefaultSslSocketFactory(OkHttpClient.java:299)
    at com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient.<init>(OkHttpClient.java:253)
    at com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:919)
    at com.facebook.presto.jdbc.PrestoDriver.<init>(PrestoDriver.java:48)
    at com.facebook.presto.jdbc.PrestoDriver.<clinit>(PrestoDriver.java:65)
. Try avoiding to initialize the class that caused initialization of the object. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace: Object was reached by 
    reading field sun.security.ssl.SSLContextImpl.secureRandom of
        constant sun.security.ssl.SSLContextImpl$TLSContext@44080492 reached by 
    reading field sun.security.ssl.SSLSocketFactoryImpl.context of
        constant sun.security.ssl.SSLSocketFactoryImpl@36d3ab49 reached by 
    reading field com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient.sslSocketFactory of
        constant com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient@49ecd0c8 reached by 
    reading field com.facebook.presto.jdbc.PrestoDriver.httpClient of
        constant com.facebook.presto.jdbc.PrestoDriver@6d0a2e53 reached by 
    reading field java.sql.DriverInfo.driver of
        constant java.sql.DriverInfo@6fdaa47 reached by 
    indexing into array
        constant java.lang.Object[]@d8e2fa6 reached by 
    reading field java.util.concurrent.CopyOnWriteArrayList.array of
        constant java.util.concurrent.CopyOnWriteArrayList@7ff98a2e reached by 
    scanning method java.sql.DriverManager.getDriver(DriverManager.java:278)
Call path from entry point to java.sql.DriverManager.getDriver(String): 
    at java.sql.DriverManager.getDriver(DriverManager.java:270)
    at io.agroal.pool.ConnectionFactory.newDriver(ConnectionFactory.java:112)
    at io.agroal.pool.ConnectionFactory.<init>(ConnectionFactory.java:68)
    at io.agroal.pool.Poolless.<init>(Poolless.java:86)
    at io.agroal.pool.DataSource.<init>(DataSource.java:35)
    at io.quarkus.agroal.runtime.DataSources.doCreateDataSource(DataSources.java:192)
    at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:112)
    at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:109)
    at sun.security.ec.ParametersMap$1.get(ParametersMap.java:78)
    at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:216)
    at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:169)
    at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:318)
    at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VARARGS_System_getProperty_deeeaa72a006d330408a3b7d002c7533e108bc28(generated:0)

    at com.oracle.svm.core.util.UserError.abort(UserError.java:87)
    at com.oracle.svm.hosted.FallbackFeature.reportAsFallback(FallbackFeature.java:233)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:731)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:537)
    at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:494)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:426)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:587)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:126)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:617)
Caused by: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Detected an instance of Random/SplittableRandom class in the image heap. Instances created during image generation have cached seed values and don't behave as expected.  Object has been initialized by the com.facebook.presto.jdbc.PrestoDriver class initializer with a trace: 
    at java.security.SecureRandom.<init>(SecureRandom.java:224)
    at sun.security.ssl.SSLContextImpl.engineInit(SSLContextImpl.java:103)
    at javax.net.ssl.SSLContext.init(SSLContext.java:314)
    at com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient.systemDefaultSslSocketFactory(OkHttpClient.java:299)
    at com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient.<init>(OkHttpClient.java:253)
    at com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient$Builder.build(OkHttpClient.java:919)
    at com.facebook.presto.jdbc.PrestoDriver.<init>(PrestoDriver.java:48)
    at com.facebook.presto.jdbc.PrestoDriver.<clinit>(PrestoDriver.java:65)
. Try avoiding to initialize the class that caused initialization of the object. The object was probably created by a class initializer and is reachable from a static field. You can request class initialization at image runtime by using the option --initialize-at-run-time=<class-name>. Or you can write your own initialization methods and call them explicitly from your main entry point.
Detailed message:
Trace: Object was reached by 
    reading field sun.security.ssl.SSLContextImpl.secureRandom of
        constant sun.security.ssl.SSLContextImpl$TLSContext@44080492 reached by 
    reading field sun.security.ssl.SSLSocketFactoryImpl.context of
        constant sun.security.ssl.SSLSocketFactoryImpl@36d3ab49 reached by 
    reading field com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient.sslSocketFactory of
        constant com.facebook.presto.jdbc.internal.okhttp3.OkHttpClient@49ecd0c8 reached by 
    reading field com.facebook.presto.jdbc.PrestoDriver.httpClient of
        constant com.facebook.presto.jdbc.PrestoDriver@6d0a2e53 reached by 
    reading field java.sql.DriverInfo.driver of
        constant java.sql.DriverInfo@6fdaa47 reached by 
    indexing into array
        constant java.lang.Object[]@d8e2fa6 reached by 
    reading field java.util.concurrent.CopyOnWriteArrayList.array of
        constant java.util.concurrent.CopyOnWriteArrayList@7ff98a2e reached by 
    scanning method java.sql.DriverManager.getDriver(DriverManager.java:278)
Call path from entry point to java.sql.DriverManager.getDriver(String): 
    at java.sql.DriverManager.getDriver(DriverManager.java:270)
    at io.agroal.pool.ConnectionFactory.newDriver(ConnectionFactory.java:112)
    at io.agroal.pool.ConnectionFactory.<init>(ConnectionFactory.java:68)
    at io.agroal.pool.Poolless.<init>(Poolless.java:86)
    at io.agroal.pool.DataSource.<init>(DataSource.java:35)
    at io.quarkus.agroal.runtime.DataSources.doCreateDataSource(DataSources.java:192)
    at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:112)
    at io.quarkus.agroal.runtime.DataSources$1.apply(DataSources.java:109)
    at sun.security.ec.ParametersMap$1.get(ParametersMap.java:78)
    at com.oracle.svm.core.jdk.SystemPropertiesSupport.initializeLazyValue(SystemPropertiesSupport.java:216)
    at com.oracle.svm.core.jdk.SystemPropertiesSupport.getProperty(SystemPropertiesSupport.java:169)
    at com.oracle.svm.core.jdk.Target_java_lang_System.getProperty(JavaLangSubstitutions.java:318)
    at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VARARGS_System_getProperty_deeeaa72a006d330408a3b7d002c7533e108bc28(generated:0)

    at com.oracle.graal.pointsto.constraints.UnsupportedFeatures.report(UnsupportedFeatures.java:126)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:728)
    ... 6 more
Error: Image build request failed with exit status 1

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':quarkusBuild'.
> io.quarkus.builder.BuildException: Build failure: Build failed due to errors
    [error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
    at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:397)
    at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:238)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:568)
    at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:882)
    at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
    at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
    at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
    at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
    at java.base/java.lang.Thread.run(Thread.java:833)
    at org.jboss.threads.JBossThread.run(JBossThread.java:501)


* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --debug option to get more log output.
> Run with --scan to get full insights.

* Get more help at https://help.gradle.org

BUILD FAILED in 4m 34s

> Task :quarkusBuild FAILED
Watching 126 directories to track changes
Watching 127 directories to track changes
Watching 127 directories to track changes
:quarkusBuild (Thread[Execution worker for ':' Thread 3,5,main]) completed. Took 3 mins 34.587 secs.

例外情况#1:

Caused by: java.sql.SQLException: Error executing query
        at com.facebook.presto.jdbc.PrestoStatement.internalExecute(PrestoStatement.java:307)
        at com.facebook.presto.jdbc.PrestoStatement.execute(PrestoStatement.java:230)
        at com.facebook.presto.jdbc.PrestoPreparedStatement.<init>(PrestoPreparedStatement.java:84)
        at com.facebook.presto.jdbc.PrestoConnection.prepareStatement(PrestoConnection.java:142)
        at io.agroal.pool.wrapper.ConnectionWrapper.prepareStatement(ConnectionWrapper.java:659)
        at org.jooq.impl.ProviderEnabledConnection.prepareStatement(ProviderEnabledConnection.java:109)
        at org.jooq.impl.SettingsEnabledConnection.prepareStatement(SettingsEnabledConnection.java:82)
        at org.jooq.impl.AbstractResultQuery.prepare(AbstractResultQuery.java:210)
        at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:307)
        ... 21 more
Caused by: java.lang.RuntimeException: Error starting query at https://presto.company.com/v1/statement returned an invalid response: JsonResponse{statusCode=200, statusMessage=OK, headers={connection=[keep-alive], content-length=[576], content-type=[application/json], date=[Fri, 04 Mar 2022 13:05:20 GMT], strict-transport-security=[max-age=15724800; includeSubDomains], x-content-type-options=[nosniff]}, hasValue=false} [Error: {"id":"20220304_130520_46663_f6dwy","infoUri":"https://presto.company.com/ui/query.html?20220304_130520_46663_f6dwy","nextUri":"https://presto.company.com/v1/statement/queued/20220304_130520_46663_f6dwy/y10055c8764fa947438d032161e4d18444ee5f009/1","stats":{"state":"QUEUED","queued":true,"scheduled":false,"nodes":0,"totalSplits":0,"queuedSplits":0,"runningSplits":0,"completedSplits":0,"cpuTimeMillis":0,"wallTimeMillis":0,"queuedTimeMillis":0,"elapsedTimeMillis":0,"processedRows":0,"processedBytes":0,"physicalInputBytes":0,"peakMemoryBytes":0,"spilledBytes":0},"warnings":[]}
]
        at com.facebook.presto.jdbc.internal.client.StatementClientV1.requestFailedException(StatementClientV1.java:497)
        at com.facebook.presto.jdbc.internal.client.StatementClientV1.<init>(StatementClientV1.java:138)
        at com.facebook.presto.jdbc.internal.client.StatementClientFactory.newStatementClient(StatementClientFactory.java:24)
        at com.facebook.presto.jdbc.QueryExecutor.startQuery(QueryExecutor.java:46)
        at com.facebook.presto.jdbc.PrestoConnection.startQuery(PrestoConnection.java:768)
        at com.facebook.presto.jdbc.PrestoStatement.internalExecute(PrestoStatement.java:263)
        ... 29 more
Caused by: java.lang.IllegalArgumentException: Unable to create class com.facebook.presto.jdbc.internal.client.QueryResults from JSON response:
[{"id":"20220304_130520_46663_f6dwy","infoUri":"https://presto.company.com/ui/query.html?20220304_130520_46663_f6dwy","nextUri":"https://presto.company.com/v1/statement/queued/20220304_130520_46663_f6dwy/y10055c8764fa947438d032161e4d18444ee5f009/1","stats":{"state":"QUEUED","queued":true,"scheduled":false,"nodes":0,"totalSplits":0,"queuedSplits":0,"runningSplits":0,"completedSplits":0,"cpuTimeMillis":0,"wallTimeMillis":0,"queuedTimeMillis":0,"elapsedTimeMillis":0,"processedRows":0,"processedBytes":0,"physicalInputBytes":0,"peakMemoryBytes":0,"spilledBytes":0},"warnings":[]}
]
        at com.facebook.presto.jdbc.internal.client.JsonResponse.<init>(JsonResponse.java:70)
        at com.facebook.presto.jdbc.internal.client.JsonResponse.execute(JsonResponse.java:144)
        at com.facebook.presto.jdbc.internal.client.StatementClientV1.<init>(StatementClientV1.java:135)
        ... 33 more
Caused by: java.lang.IllegalArgumentException: Invalid JSON string for [simple type, class com.facebook.presto.jdbc.internal.client.QueryResults]
        at com.facebook.presto.jdbc.internal.com.facebook.airlift.json.JsonCodec.fromJson(JsonCodec.java:140)
        at com.facebook.presto.jdbc.internal.client.JsonResponse.<init>(JsonResponse.java:67)
        ... 35 more
Caused by: com.facebook.presto.jdbc.internal.jackson.databind.exc.InvalidDefinitionException: Cannot construct instance of `com.facebook.presto.jdbc.internal.client.QueryResults` (no Creators, like default construct, exist): cannot deserialize from Object value (no delegate- or property-based Creator)
 at [Source: (String)"{"id":"20220304_130520_46663_f6dwy","infoUri":"https://presto.company.com/ui/query.html?20220304_130520_46663_f6dwy","nextUri":"https://presto.company.com/v1/statement/queued/20220304_130520_46663_f6dwy/y10055c8764fa947438d032161e4d18444ee5f009/1","stats":{"state":"QUEUED","queued":true,"scheduled":false,"nodes":0,"totalSplits":0,"queuedSplits":0,"runningSplits":0,"completedSplits":0,"cpuTimeMillis":0,"wallTimeMillis":0,"queuedTimeMillis":0,"elapsedTimeMillis":0,"processedRows":0,"processedBytes":0,"[truncated 76 chars]; line: 1, column: 2]
        at com.facebook.presto.jdbc.internal.jackson.databind.DeserializationContext.reportBadDefinition(DeserializationContext.java:1589)
        at com.facebook.presto.jdbc.internal.jackson.databind.DeserializationContext.handleMissingInstantiator(DeserializationContext.java:1055)
        at com.facebook.presto.jdbc.internal.jackson.databind.deser.BeanDeserializerBase.deserializeFromObjectUsingNonDefault(BeanDeserializerBase.java:1297)
        at com.facebook.presto.jdbc.internal.jackson.databind.deser.BeanDeserializer.deserializeFromObject(BeanDeserializer.java:326)
        at com.facebook.presto.jdbc.internal.jackson.databind.deser.BeanDeserializer.deserialize(BeanDeserializer.java:159)
        at com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader._bindAndClose(ObjectReader.java:1719)
        at com.facebook.presto.jdbc.internal.jackson.databind.ObjectReader.readValue(ObjectReader.java:1261)
        at com.facebook.presto.jdbc.internal.com.facebook.airlift.json.JsonCodec.fromJson(JsonCodec.java:137)
        ... 36 more

例外情况#N:。。。。

共有1个答案

壤驷安和
2023-03-14

要修复GraalVM本机生成错误,请添加以下属性quarkus。出生地的额外构建args和quarkus。出生地的将所有字符集添加到src/main/resources/application。属性(标准Quarkus属性):

quarkus.native.add-all-charsets=true
quarkus.native.additional-build-args=--initialize-at-run-time=com.facebook.presto.jdbc.PrestoDriver

或者src/main/resources/application。yaml(使用扩展quarkus配置yaml时):

quarkus:
  native:
    add-all-charsets: true
    additional-build-args: --initialize-at-run-time=com.facebook.presto.jdbc.PrestoDriver


基本上Presto DB JDBC包com.facebook.presto.jdbc.internal.client的所有类都在内部使用Jackson,因此需要注册以进行反射。

package com.company.api.graal;

import io.quarkus.runtime.annotations.RegisterForReflection;

/**
 * @author ThoSap
 */
@RegisterForReflection(targets = {
    com.facebook.presto.jdbc.internal.client.ClientException.class,
    com.facebook.presto.jdbc.internal.client.ClientSession.class,
    com.facebook.presto.jdbc.internal.client.ClientTypeSignature.class,
    com.facebook.presto.jdbc.internal.client.ClientTypeSignatureParameter.class,
    com.facebook.presto.jdbc.internal.client.ClientTypeSignatureParameter.ClientTypeSignatureParameterDeserializer.class,
    com.facebook.presto.jdbc.internal.client.Column.class,
    com.facebook.presto.jdbc.internal.client.ErrorLocation.class,
    com.facebook.presto.jdbc.internal.client.FailureInfo.class,
    com.facebook.presto.jdbc.internal.client.GCSOAuthInterceptor.class,
    com.facebook.presto.jdbc.internal.client.GCSOAuthScope.class,
    com.facebook.presto.jdbc.internal.client.IntervalDayTime.class,
    com.facebook.presto.jdbc.internal.client.IntervalYearMonth.class,
    com.facebook.presto.jdbc.internal.client.JsonResponse.class,
    com.facebook.presto.jdbc.internal.client.KerberosUtil.class,
    com.facebook.presto.jdbc.internal.client.NodeVersion.class,
    com.facebook.presto.jdbc.internal.client.OkHttpUtil.class,
    com.facebook.presto.jdbc.internal.client.OkHttpUtil.NullCallback.class,
    com.facebook.presto.jdbc.internal.client.PrestoHeaders.class,
    com.facebook.presto.jdbc.internal.client.QueryData.class,
    com.facebook.presto.jdbc.internal.client.QueryError.class,
    com.facebook.presto.jdbc.internal.client.QueryResults.class,
    com.facebook.presto.jdbc.internal.client.QueryStatusInfo.class,
    com.facebook.presto.jdbc.internal.client.ServerInfo.class,
    com.facebook.presto.jdbc.internal.client.SocketChannelSocketFactory.class,
    com.facebook.presto.jdbc.internal.client.SpnegoHandler.class,
    com.facebook.presto.jdbc.internal.client.StageStats.class,
    com.facebook.presto.jdbc.internal.client.StageStats.Builder.class,
    com.facebook.presto.jdbc.internal.client.StatementClient.class,
    com.facebook.presto.jdbc.internal.client.StatementClientFactory.class,
    com.facebook.presto.jdbc.internal.client.StatementStats.class,
    com.facebook.presto.jdbc.internal.client.StatementStats.Builder.class
})
public class PrestoDBReflection {

}
 类似资料: