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

UnsatisfiedLinkError on ch.qos.logback.classic.Logger #2

Open
spiritokko opened this issue May 24, 2019 · 3 comments
Open

UnsatisfiedLinkError on ch.qos.logback.classic.Logger #2

spiritokko opened this issue May 24, 2019 · 3 comments

Comments

@spiritokko
Copy link

Hello,
I'm trying to reuse your library on one of my spring boot applications. After some tweaks I've been able to generate native image and start it successfully.
After the web server is up & running, at each request I get the following error:

Exception in thread "reactor-http-nio-2" java.lang.UnsatisfiedLinkError: sun.reflect.Reflection.getCallerClass(I)Ljava/lang/Class; [symbol: Java_sun_reflect_Reflection_getCallerClass or Java_sun_reflect_Reflection_getCallerClass__I]
at com.oracle.svm.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:145)
at com.oracle.svm.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:57)
at sun.reflect.Reflection.getCallerClass(Reflection.java)
at ch.qos.logback.classic.spi.PackagingDataCalculator.populateFrames(PackagingDataCalculator.java:85)
at ch.qos.logback.classic.spi.PackagingDataCalculator.calculate(PackagingDataCalculator.java:58)
at ch.qos.logback.classic.spi.ThrowableProxy.calculatePackagingData(ThrowableProxy.java:142)
at ch.qos.logback.classic.spi.LoggingEvent.(LoggingEvent.java:122)
at ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Logger.java:419)
at ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Logger.java:383)
at ch.qos.logback.classic.Logger.log(Logger.java:765)
at io.netty.util.internal.logging.LocationAwareSlf4JLogger.log(LocationAwareSlf4JLogger.java:46)
at io.netty.util.internal.logging.LocationAwareSlf4JLogger.warn(LocationAwareSlf4JLogger.java:209)
at io.netty.util.concurrent.SingleThreadEventExecutor$5.run(SingleThreadEventExecutor.java:908)
at java.lang.Thread.run(Thread.java:748)
at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:473)
at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)

I was wondering if this has to do with missing entries in reflect.json file.
thanks for your support

@guanchao-yang
Copy link

We see the same problem today with Spring Boot deployment too using GraalVM.

@spiritokko
Copy link
Author

spiritokko commented Jun 4, 2019

I bypassed the issue creating a substitution directly in graal substratevm. The problem is that the method sun.reflect.Reflection.getCallerClass(int) is no more supported in Java8, hance not implemented in substratevm.
The workaround I used is to force the substitution of this method via this implementation

@Substitute public static Class<?> getCallerClass(int depth) { return null; }

in the file com.oracle.svm.core/src/com/oracle/svm/core/jdk/Target_jdk_internal_reflect_Reflection.java
within graal/substratevm

Another possible approach is to try update the logback library: as you can see the current version 1.2.3 is a bit old and the current alpha implementation of the PackagingDataCalculator class (that triggers the getCallerClass call) does not contain reference to this method anymore:

if (GET_CALLER_CLASS_METHOD_AVAILABLE) { //callerClass = Reflection.getCallerClass(localFirstCommon + i - missfireCount + 1); }

I used as a reference this thread: oracle/graal#748

@aclement
Copy link
Owner

Simplest thing to do is remove logback and then you'll see the real problem that is causing it to need to do the digging for stack trace info.

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

3 participants