Skip to content

Ubuntu java.lang.UnsatisfiedLinkError: jdk.jfr.internal.JVM.getHandler(Ljava/lang/Class;)Ljava/lang/Object; [symbol: Java_jdk_jfr_internal_JVM_getHandler or Java_jdk_jfr_internal_JVM_getHandler__Ljava_lang_Class_2] #8623

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

Closed
Leon-JL opened this issue Mar 22, 2024 · 2 comments
Assignees
Labels

Comments

@Leon-JL
Copy link

Leon-JL commented Mar 22, 2024

I use the native-image-agent to generate the metadata to resources/META-INF/native-image folder, then compile the spring boot project to native image with the META-INF/native-image folder , there is an error when running. But if I do not use the META-INF/native-image folder, instead use the SpringBoot's HitConfig to add some metadata, the issue will not reproduce.

java.lang.UnsatisfiedLinkError: jdk.jfr.internal.JVM.getHandler(Ljava/lang/Class;)Ljava/lang/Object; [symbol: Java_jdk_jfr_internal_JVM_getHandler or Java_jdk_jfr_internal_JVM_getHandler__Ljava_lang_Class_2]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.access.JNINativeLinkage.getOrFindEntryPoint(JNINativeLinkage.java:152) ~[na:na]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.JNIGeneratedMethodSupport.nativeCallAddress(JNIGeneratedMethodSupport.java:53) ~[na:na]
        at jdk.jfr@17.0.10/jdk.jfr.internal.JVM.getHandler(Native Method) ~[na:na]
        at jdk.jfr@17.0.10/jdk.jfr.internal.Utils.getHandler(Utils.java:449) ~[na:na]
        at jdk.jfr@17.0.10/jdk.jfr.internal.MetadataRepository.getHandler(MetadataRepository.java:174) ~[na:na]
        at jdk.jfr@17.0.10/jdk.jfr.internal.MetadataRepository.register(MetadataRepository.java:135) ~[na:na]
        at jdk.jfr@17.0.10/jdk.jfr.internal.MetadataRepository.register(MetadataRepository.java:130) ~[na:na]
        at jdk.jfr@17.0.10/jdk.jfr.FlightRecorder.register(FlightRecorder.java:136) ~[na:na]
        at io.lettuce.core.event.connection.JfrConnectionCreatedEvent.<clinit>(JfrConnectionCreatedEvent.java) ~[auth-service:6.3.1.RELEASE/12e6995]
        at java.base@17.0.10/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[auth-service:na]
        at java.base@17.0.10/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[auth-service:na]
        at io.lettuce.core.event.jfr.JfrEventRecorder.createEvent(JfrEventRecorder.java:108) ~[na:na]
        at io.lettuce.core.event.jfr.JfrEventRecorder.record(JfrEventRecorder.java:48) ~[na:na]
        at io.lettuce.core.AbstractRedisClient.initializeChannelAsync(AbstractRedisClient.java:398) ~[auth-service:6.3.1.RELEASE/12e6995]
        at io.lettuce.core.RedisClient.connectStatefulAsync(RedisClient.java:324) ~[auth-service:6.3.1.RELEASE/12e6995]
        at io.lettuce.core.RedisClient.connectStandaloneAsync(RedisClient.java:286) ~[auth-service:6.3.1.RELEASE/12e6995]
        at io.lettuce.core.RedisClient.connect(RedisClient.java:215) ~[auth-service:6.3.1.RELEASE/12e6995]
        at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.lambda$getConnection$1(StandaloneConnectionProvider.java:112) ~[auth-service:3.2.3]
        at java.base@17.0.10/java.util.Optional.orElseGet(Optional.java:364) ~[auth-service:na]
        at org.springframework.data.redis.connection.lettuce.StandaloneConnectionProvider.getConnection(StandaloneConnectionProvider.java:112) ~[auth-service:3.2.3]
        at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.lambda$getConnection$0(LettucePoolingConnectionProvider.java:93) ~[na:na]
        at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:211) ~[na:na]
        at io.lettuce.core.support.ConnectionPoolSupport$RedisPooledObjectFactory.create(ConnectionPoolSupport.java:201) ~[na:na]
        at org.apache.commons.pool2.BasePooledObjectFactory.makeObject(BasePooledObjectFactory.java:71) ~[auth-service:2.12.0]
        at org.apache.commons.pool2.impl.GenericObjectPool.create(GenericObjectPool.java:566) ~[auth-service:2.12.0]
        at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:306) ~[auth-service:2.12.0]
        at org.apache.commons.pool2.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:233) ~[auth-service:2.12.0]
        at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:122) ~[auth-service:6.3.1.RELEASE/12e6995]
        at io.lettuce.core.support.ConnectionPoolSupport$1.borrowObject(ConnectionPoolSupport.java:117) ~[auth-service:6.3.1.RELEASE/12e6995]
        at org.springframework.data.redis.connection.lettuce.LettucePoolingConnectionProvider.getConnection(LettucePoolingConnectionProvider.java:99) ~[na:na]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$ExceptionTranslatingConnectionProvider.getConnection(LettuceConnectionFactory.java:1724) ~[na:na]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getNativeConnection(LettuceConnectionFactory.java:1528) ~[auth-service:3.2.3]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.lambda$getConnection$0(LettuceConnectionFactory.java:1508) ~[auth-service:3.2.3]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.doInLock(LettuceConnectionFactory.java:1469) ~[auth-service:3.2.3]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory$SharedConnection.getConnection(LettuceConnectionFactory.java:1505) ~[auth-service:3.2.3]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getSharedConnection(LettuceConnectionFactory.java:1191) ~[auth-service:3.2.3]
        at org.springframework.data.redis.connection.lettuce.LettuceConnectionFactory.getConnection(LettuceConnectionFactory.java:997) ~[auth-service:3.2.3]
        at org.springframework.data.redis.core.RedisConnectionUtils.fetchConnection(RedisConnectionUtils.java:194) ~[na:na]
        at org.springframework.data.redis.core.RedisConnectionUtils.doGetConnection(RedisConnectionUtils.java:143) ~[na:na]
        at org.springframework.data.redis.core.RedisConnectionUtils.getConnection(RedisConnectionUtils.java:104) ~[na:na]
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:383) ~[auth-service:3.2.3]
        at org.springframework.data.redis.core.RedisTemplate.execute(RedisTemplate.java:363) ~[auth-service:3.2.3]
        at org.springframework.data.redis.core.AbstractOperations.execute(AbstractOperations.java:97) ~[auth-service:3.2.3]
        at org.springframework.data.redis.core.DefaultHashOperations.get(DefaultHashOperations.java:51) ~[auth-service:3.2.3]
        at xxxxxx
        at io.netty.util.concurrent.AbstractEventExecutor.runTask(AbstractEventExecutor.java:173) ~[auth-service:4.1.107.Final]
        at io.netty.util.concurrent.AbstractEventExecutor.safeExecute(AbstractEventExecutor.java:166) ~[auth-service:4.1.107.Final]
        at io.netty.util.concurrent.SingleThreadEventExecutor.runAllTasks(SingleThreadEventExecutor.java:470) ~[auth-service:4.1.107.Final]
        at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:569) ~[na:na]
        at io.netty.util.concurrent.SingleThreadEventExecutor$4.run(SingleThreadEventExecutor.java:997) ~[na:na]
        at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) ~[na:na]
        at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) ~[na:na]
        at java.base@17.0.10/java.lang.Thread.run(Thread.java:842) ~[auth-service:na]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.thread.PlatformThreads.threadStartRoutine(PlatformThreads.java:807) ~[auth-service:na]
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.posix.thread.PosixPlatformThreads.pthreadStartRoutine(PosixPlatformThreads.java:210) ~[na:na]

Enviroment

-GraalVM:
java version "17.0.10" 2024-01-16 LTS
Java(TM) SE Runtime Environment Oracle GraalVM 17.0.10+11.1 (build 17.0.10+11-LTS-jvmci-23.0-b27)
Java HotSpot(TM) 64-Bit Server VM Oracle GraalVM 17.0.10+11.1 (build 17.0.10+11-LTS-jvmci-23.0-b27, mixed mode, sharing)

-OS:
Distributor ID: Ubuntu
Description: Ubuntu 18.04.6 LTS
Release: 18.04
Codename: bionic

-Architecture:
Linux Dev 5.4.0-150-generic #167~18.04.1-Ubuntu SMP Wed May 24 00:51:42 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

maven dependents:

 <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>3.2.3</version>
    </parent>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-redis</artifactId>
        </dependency>

        <dependency>
            <groupId>io.netty</groupId>
            <artifactId>netty-all</artifactId>
            <version>4.1.107.Final</version>
        </dependency>

        <dependency>
            <groupId>redis.clients</groupId>
            <artifactId>jedis</artifactId>
            <version>5.1.2</version>
        </dependency>

        <dependency>
            <groupId>io.lettuce</groupId>
            <artifactId>lettuce-core</artifactId>
            <version>6.3.1.RELEASE</version>
        </dependency>
@Leon-JL Leon-JL added the bug label Mar 22, 2024
@fernando-valdez fernando-valdez self-assigned this Mar 23, 2024
@fernando-valdez
Copy link
Member

Based on the logs, it looks like you are using JFR in the native image.
Please confirm if you followed the instructions in this guide about using JFRs + native image:
https://www.graalvm.org/latest/reference-manual/native-image/guides/build-and-run-native-executable-with-jfr/

@Leon-JL
Copy link
Author

Leon-JL commented Mar 25, 2024

Thanks for your feedback. When I add the --enable-monitoring=jfr args, the issue will not reproduce. I will close the issue. But I don't quite understand why this issue doesn't occur when build native image without the configuration file in META-INF/native

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

No branches or pull requests

2 participants