Does anyone have information about Authorize.net support GraalVm or not?
We are moving our project to Native Image and getting following exception in creating native image:
Error: Unsupported features in 2 methods
Detailed message:
Error: Detected a MBean server in the image heap. This is currently not supported, but could be changed in the future. Management beans are registered in many global caches that would
need to be cleared and properly re-built at image build time. Class of disallowed object: com.sun.jmx.mbeanserver.JmxMBeanServer To see how this object got instantiated use --trace-ob
ject-instantiation=com.sun.jmx.mbeanserver.JmxMBeanServer. The object was probably created by a class initializer and is reachable from a static field. You can request class initializa
tion 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.
Trace: Object was reached by
indexing into array
constant java.lang.Object[]#7504af74 reached by
reading field java.util.ArrayList.elementData of
constant java.util.ArrayList#24b75efc reached by
scanning method javax.management.MBeanServerFactory.addMBeanServer(MBeanServerFactory.java:418)
Call path from entry point to javax.management.MBeanServerFactory.addMBeanServer(MBeanServer):
at javax.management.MBeanServerFactory.addMBeanServer(MBeanServerFactory.java:418)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:232)
at javax.management.MBeanServerFactory.createMBeanServer(MBeanServerFactory.java:192)
at com.oracle.svm.core.jdk.management.ManagementSupport.getPlatformMBeanServer(ManagementSupport.java:257)
at com.oracle.svm.core.jdk.management.Target_java_lang_management_ManagementFactory.getPlatformMBeanServer(Target_java_lang_management_ManagementFactory.java:45)
at org.apache.logging.log4j.core.jmx.Server.unregisterLoggerContext(Server.java:248)
at org.apache.logging.log4j.core.LoggerContext.stop(LoggerContext.java:379)
at org.apache.logging.log4j.core.LoggerContext$1.run(LoggerContext.java:320)
at java.lang.Thread.run(Thread.java:829)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:600)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:192)
at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)
Error: type is not available in this platform: org.graalvm.compiler.hotspot.management.AggregatedMemoryPoolBean
Trace: Object was reached by
reading field java.lang.ref.Reference.referent of
constant java.util.WeakHashMap$Entry#5e4acddb reached by
indexing into array
constant java.util.WeakHashMap$Entry[]#5eed71e9 reached by
reading field java.util.WeakHashMap.table of
constant com.sun.jmx.mbeanserver.MBeanIntrospector$MBeanInfoMap#33ac075d reached by
scanning method com.sun.jmx.mbeanserver.MXBeanIntrospector.getMBeanInfoMap(MXBeanIntrospector.java:68)
Call path from entry point to com.sun.jmx.mbeanserver.MXBeanIntrospector.getMBeanInfoMap():
at com.sun.jmx.mbeanserver.MXBeanIntrospector.getMBeanInfoMap(MXBeanIntrospector.java:68)
at com.sun.jmx.mbeanserver.MBeanIntrospector.getClassMBeanInfo(MBeanIntrospector.java:416)
at com.sun.jmx.mbeanserver.MBeanIntrospector.getMBeanInfo(MBeanIntrospector.java:392)
at com.sun.jmx.mbeanserver.MBeanSupport.<init>(MBeanSupport.java:139)
at com.sun.jmx.mbeanserver.MXBeanSupport.<init>(MXBeanSupport.java:66)
at com.sun.jmx.mbeanserver.Introspector.makeDynamicMBean(Introspector.java:203)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerObject(DefaultMBeanServerInterceptor.java:888)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.registerMBean(DefaultMBeanServerInterceptor.java:320)
at com.sun.jmx.mbeanserver.JmxMBeanServer$2.run(JmxMBeanServer.java:1225)
at com.oracle.svm.core.jdk.Target_java_security_AccessController.doPrivileged(SecuritySubstitutions.java:123)
at java.util.ServiceLoader.loadProvider(ServiceLoader.java:859)
at java.util.ServiceLoader$LayerLookupIterator.hasNext(ServiceLoader.java:952)
at sun.java2d.SunGraphics2D.setRenderingHints(SunGraphics2D.java:1370)
at com.oracle.svm.jni.JNIJavaCallWrappers.jniInvoke_VARARGS_SunGraphics2D_setRenderingHints_8d5833c6be813de16ff61d40a14ac79dc4dda89c(generated:0)
The issue does not explicitly points to Authorize.net SDK, but it resolved when the following dependency is removed:
<dependency>
<groupId>net.authorize</groupId>
<artifactId>anet-java-sdk</artifactId>
<version>LATEST</version>
</dependency>
I have also tried adding --initialize-at-run-time=com.sun.jmx.mbeanserver.JmxMBeanServer, but the issue still persists
Java version "11.0.10" 2021-01-19 LTS
Quarkus version : 2.5.0.Final
GraalVM: 21.3
Maven version: Apache Maven 3.8.1
if I want to build my Quarkus 2.7.3.Final application with GraalVM CE 22.0.0.2 in native mode, I get a build error caused by the PrestoDB JDBC driver.
Also, I get the following exceptions when I make a SQL query on PrestoDB 0.270 and it only occurs if I run the application in native mode.
With the Quarkus JVM mode, the query just works fine.
Docker build image: quay.io/quarkus/ubi-quarkus-native-image:22.0.0-java17
I'm using JDBC driver com.facebook.presto:presto-jdbc:0.270 with a custom agroal connection and driver class com.facebook.presto.jdbc.PrestoDriver
GraalVM build error:
/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.
Exception #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
Exception #N:
....
To fix the GraalVM native build error add the following properties quarkus.native.additional-build-args and quarkus.native.add-all-charsets to src/main/resources/application.properties (standard Quarkus properties):
quarkus.native.add-all-charsets=true
quarkus.native.additional-build-args=--initialize-at-run-time=com.facebook.presto.jdbc.PrestoDriver
or src/main/resources/application.yaml (when extension quarkus-config-yaml is used):
quarkus:
native:
add-all-charsets: true
additional-build-args: --initialize-at-run-time=com.facebook.presto.jdbc.PrestoDriver
To fix the native mode runtime exceptions add an empty class annotated with bean #RegisterForReflection (the name of the class does not matter with the following content.
Basically all classes of Presto DB JDBC package com.facebook.presto.jdbc.internal.client are using Jackson internally and therefore need to be registered for reflection.
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 {
}
Thorntail using project-defaults.yaml
Using the below command line arguments to start the application.
Trying to pass location of a Java .properties file to use as system properties.
java -jar application-thorntail.jar -P ../config/application.properties -P ../config/application-dev.properties -s ../config/project-defaults.yaml
Property key value in
application.properties
mail.smtp.password=testpass
tds.username=username
In yaml i want to evaluate the value as below
mail:
mail-sessions:
default:
smtp-server:
username: ${mail.smtp.user}
password: ${mail.smtp.password}
outbound-socket-binding-ref: mail-smtp
jndi-name: java:jboss/mail/Default
However, on a statup values are not getting evaluated
Error getting subresources for ConnectionDefinitions
java.lang.RuntimeException: Failed to adopt value java.lang.String
at org.wildfly.swarm.config.runtime.invocation.EntityAdapter.fromEntity(EntityAdapter.java:346)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:33)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshalSubresources(Marshaller.java:129)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:38)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshalSubresources(Marshaller.java:129)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:38)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshalSubresources(Marshaller.java:129)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.appendNode(Marshaller.java:38)
at org.wildfly.swarm.config.runtime.invocation.Marshaller.marshal(Marshaller.java:23)
at org.wildfly.swarm.container.runtime.marshal.SubsystemMarshaller.marshal(SubsystemMarshaller.java:59)
at org.wildfly.swarm.container.runtime.marshal.SubsystemMarshaller$Proxy$_$$_WeldClientProxy.marshal(Unknown Source)
at org.wildfly.swarm.container.runtime.marshal.DMRMarshaller.marshal(DMRMarshaller.java:70)
at org.wildfly.swarm.container.runtime.marshal.DMRMarshaller$Proxy$_$$_WeldClientProxy.marshal(Unknown Source)
at org.wildfly.swarm.container.runtime.RuntimeServer.start(RuntimeServer.java:194)
at org.wildfly.swarm.container.runtime.RuntimeServer$Proxy$_$$_WeldClientProxy.start(Unknown Source)
at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.lambda$bootstrap$1(ServerBootstrapImpl.java:159)
at org.wildfly.swarm.spi.api.ClassLoading.withTCCL(ClassLoading.java:43)
at org.wildfly.swarm.container.runtime.ServerBootstrapImpl.bootstrap(ServerBootstrapImpl.java:113)
at org.wildfly.swarm.Swarm.start(Swarm.java:401)
at org.wildfly.swarm.Swarm.main(Swarm.java:745)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.wildfly.swarm.bootstrap.MainInvoker.invoke(MainInvoker.java:57)
at org.wildfly.swarm.bootstrap.Main.run(Main.java:134)
at org.wildfly.swarm.bootstrap.Main.main(Main.java:87)
Caused by: java.lang.IllegalStateException: Failed to resolve expression: ${tds.username}
at org.jboss.dmr.ValueExpressionResolver.resolve(ValueExpressionResolver.java:128)
at org.jboss.dmr.ValueExpression.resolveString(ValueExpression.java:163)
at org.jboss.dmr.ValueExpression.resolveString(ValueExpression.java:153)
at org.wildfly.swarm.config.runtime.invocation.SimpleTypeAdapter.toDmr(SimpleTypeAdapter.java:22)
at org.wildfly.swarm.config.runtime.invocation.EntityAdapter.fromEntity(EntityAdapter.java:343)
... 26 more
Well, first of all you defined your property as tds.username, but you are tring to access it as mail.smtp.user.
If this was just a mistake when writing the example, maybe you could try using ${env.XXX}.
Change your property file from mail.smtp.user to MAIL_SMTP_USER and then, on project-defaults, use username: ${env.MAIL_SMTP_USER}.
If this works, you could even propose a default value (in the example below, "defaultusername"):
username: ${env.MAIL_SMTP_USER:defaultusername}
Important to note that I don't have the tools to test it.
I am using db2 version 10.5 and inserting the values into the DB2JSON, created a simple standalone java program to retrieve all the values from the table(Collection) when I run the query I am getting the following error
Exception in thread "main" java.lang.RuntimeException: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][3.69.66] Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.nosql.json.api.DBObjectRowHandler.handle(DBObjectRowHandler.java:38)
at com.ibm.nosql.json.api.DBObjectRowHandler.handle(DBObjectRowHandler.java:14)
at com.ibm.nosql.json.api.BaseResultIterator.next(BaseResultIterator.java:119)
at com.ibm.nosql.json.api.DBCursor.fetchResultsEagerly(DBCursor.java:801)
at com.ibm.nosql.json.api.DBCursor.find(DBCursor.java:895)
at com.ibm.nosql.json.api.DBCursor.hasNext(DBCursor.java:278)
at com.ws.Demo.TestingDemo.main(TestingDemo.java:47)
Caused by: com.ibm.db2.jcc.am.SqlException: [jcc][t4][1065][12306][3.69.66] Caught java.io.CharConversionException. See attached Throwable for details. ERRORCODE=-4220, SQLSTATE=null
at com.ibm.db2.jcc.am.gd.a(gd.java:733)
at com.ibm.db2.jcc.am.gd.a(gd.java:66)
at com.ibm.db2.jcc.am.gd.a(gd.java:120)
at com.ibm.db2.jcc.am.kc.a(kc.java:2868)
at com.ibm.db2.jcc.am.kc.p(kc.java:525)
at com.ibm.db2.jcc.am.kc.Z(kc.java:2747)
at com.ibm.db2.jcc.am.ResultSet.getObjectX(ResultSet.java:1438)
at com.ibm.db2.jcc.am.ResultSet.getObject(ResultSet.java:1413)
at com.ibm.nosql.json.api.DBResultSet.getObject(DBResultSet.java:255)
at com.ibm.nosql.json.api.DBData.getObjectX(DBData.java:66)
at com.ibm.nosql.json.api.DBObjectRowHandler.getObjectID(DBObjectRowHandler.java:58)
at com.ibm.nosql.json.api.DBObjectRowHandler.handle(DBObjectRowHandler.java:28)
... 6 more
Caused by: java.nio.charset.MalformedInputException: Input length = 290
at com.ibm.db2.jcc.am.r.a(r.java:19)
at com.ibm.db2.jcc.am.kc.a(kc.java:2864)
... 14 more
Caused by: sun.io.MalformedInputException
at sun.io.ByteToCharUTF8.convert(ByteToCharUTF8.java:292)
at com.ibm.db2.jcc.am.r.a(r.java:16)
... 15 more
I also went throught few posts where it suggest to use db2.jcc.charsetDecoderEncoder=3 but I have no idea where to use it, and also I few other posts it is suggested touse the lastest version db2jcc.jar, I am using the jars that is present inside the db2 10.5 under sqllib folder. Anyone let me know how to fix this
Add the following environment variable(Java VM arguments) in your tomcat settings
-Ddb2.jcc.charsetDecoderEncoder=3
This worked.
You can set the charset decoder encoder using system property inside your Java code.
For example:
System.setProperty("db2.jcc.charsetDecoderEncoder", "3");
20:15:43 [INFO] macintosh264 issued server command: /sell hand
20:15:43 [INFO] [XYZShop] MacCommand sell executed
20:15:43 [SEVERE] null
org.bukkit.command.CommandException: Unhandled exception executing command 'sell' in plugin XYZShop v0.1.3
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:46)
at org.bukkit.command.SimpleCommandMap.dispatch(SimpleCommandMap.java:186)
at org.bukkit.craftbukkit.v1_4_6.CraftServer.dispatchCommand(CraftServer.java:510)
at net.minecraft.server.v1_4_6.PlayerConnection.handleCommand(PlayerConnection.java:979)
at net.minecraft.server.v1_4_6.PlayerConnection.chat(PlayerConnection.java:897)
at net.minecraft.server.v1_4_6.PlayerConnection.a(PlayerConnection.java:852)
at net.minecraft.server.v1_4_6.Packet3Chat.handle(Packet3Chat.java:44)
at net.minecraft.server.v1_4_6.NetworkManager.b(NetworkManager.java:290)
at net.minecraft.server.v1_4_6.PlayerConnection.d(PlayerConnection.java:112)
at net.minecraft.server.v1_4_6.ServerConnection.b(SourceFile:39)
at net.minecraft.server.v1_4_6.DedicatedServerConnection.b(SourceFile:30)
at net.minecraft.server.v1_4_6.MinecraftServer.r(MinecraftServer.java:598)
at net.minecraft.server.v1_4_6.DedicatedServer.r(DedicatedServer.java:224)
at net.minecraft.server.v1_4_6.MinecraftServer.q(MinecraftServer.java:494)
at net.minecraft.server.v1_4_6.MinecraftServer.run(MinecraftServer.java:427)
at net.minecraft.server.v1_4_6.ThreadServerApplication.run(SourceFile:849)
Caused by: java.lang.NoSuchMethodError: dev.xyzcraft.net.database.DatabaseHandler.getItem(IS)Ldev/xyzcraft/net/xyzshop/dataObject/MSItem;
at dev.xyzcraft.net.xyzshop.commands.SellCommand.onCommand(SellCommand.java:63)
at dev.xyzcraft.net.xyzshop.util.MacCommand.onCommand(MacCommand.java:44)
at org.bukkit.command.PluginCommand.execute(PluginCommand.java:44)
... 15 more
I get that exception
here's the code:
https://github.com/macintosh264/XYZShop
Lastly, I'm using a Mod API for a popular video game, Minecraft, entitled Bukkit. Here's the JavaDoc, and library
http://dl.bukkit.org/downloads/bukkit/
http://jd.bukkit.org
"I also have this problem with another project that uses MySQL, and the stack trace occurs WHENEVER the mysql class is used. "
Macintosh264
It seems like whatever your trying to execute (i.e.the method that holds the command) isn't reading it properly. Try re-packaging your project, it's happened to me many times and that is usually an easy fix.