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

Issue with gradle and maven examples #5

Open
jchrisos opened this issue Jun 24, 2019 · 1 comment
Open

Issue with gradle and maven examples #5

jchrisos opened this issue Jun 24, 2019 · 1 comment

Comments

@jchrisos
Copy link

jchrisos commented Jun 24, 2019

Hi,

I'm trying to run gradle and maven examples and I'm getting an exception

Thank you,

Steps Maven:

  • mvn install
  • native-image --static --report-unsupported-elements-at-runtime -jar target/maven-example.jar = ok
  • ./maven-example = exception

Steps gradle:

  • gradle install = ok
  • native-image --static --report-unsupported-elements-at-runtime -jar build/fatjar/example.jar = ok
  • ./example = exception

My setup:
OS: Ubuntu 18.04 LTS
Java: 1.8.0_212

I tested in macos 10.14 and got same exception.

Exception in thread "DefaultDispatcher-worker-3" java.lang.ExceptionInInitializerError at com.oracle.svm.core.hub.ClassInitializationInfo.initialize(ClassInitializationInfo.java:287) at java.lang.Class.ensureInitialized(DynamicHub.java:437) at io.ktor.network.selector.SelectableBase.<init>(Selectable.kt:38) at io.ktor.network.sockets.ServerSocketImpl.<init>(ServerSocketImpl.kt:11) at io.ktor.network.sockets.TcpSocketBuilder.bind(Builders.kt:122) at io.ktor.network.sockets.TcpSocketBuilder.bind$default(Builders.kt:114) at io.ktor.server.cio.HttpServerKt$httpServer$acceptJob$1.invokeSuspend(HttpServer.kt:88) at kotlin.coroutines.jvm.internal.BaseContinuationImpl.resumeWith(ContinuationImpl.kt:32) at kotlinx.coroutines.DispatchedTask.run(Dispatched.kt:233) at kotlinx.coroutines.scheduling.CoroutineScheduler.runSafely(CoroutineScheduler.kt:594) at kotlinx.coroutines.scheduling.CoroutineScheduler.access$runSafely(CoroutineScheduler.kt:60) at kotlinx.coroutines.scheduling.CoroutineScheduler$Worker.run(CoroutineScheduler.kt:742) at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:473) at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193) Caused by: java.lang.RuntimeException: java.lang.NoSuchFieldException: readHandlerReference at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.<init>(AtomicReferenceFieldUpdater.java:162) at java.util.concurrent.atomic.AtomicReferenceFieldUpdater.newUpdater(AtomicReferenceFieldUpdater.java:110) at io.ktor.network.selector.InterestSuspensionsMap.<clinit>(InterestSuspensionsMap.kt:61) at com.oracle.svm.core.hub.ClassInitializationInfo.invokeClassInitializer(ClassInitializationInfo.java:347) at com.oracle.svm.core.hub.ClassInitializationInfo.initialize(ClassInitializationInfo.java:267) ... 13 more Caused by: java.lang.NoSuchFieldException: readHandlerReference at java.lang.Class.getDeclaredField(DynamicHub.java:2070) at java.util.concurrent.atomic.AtomicReferenceFieldUpdater$AtomicReferenceFieldUpdaterImpl.<init>(AtomicReferenceFieldUpdater.java:157) ... 17 more

@drampelt
Copy link

I fixed this by adding this argument to native-image: --initialize-at-build-time=io.ktor,kotlinx,kotlin,org.slf4j

Not sure if all of those are strictly necessary of if they can be made more specific but it worked for me

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

No branches or pull requests

2 participants