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

resolve the issue of java.lang.NullPointerException in springboot jar #153

Closed
wants to merge 1 commit into from

Conversation

huazai023
Copy link

When using zenoh java jvm in springboot jar, the following error occurred:

java.lang.Exception: Unable to load Zenoh JNI: java.lang.NullPointerException
at io.zenoh.Zenoh$Companion.tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:137)
at io.zenoh.Zenoh$Companion.access$tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:29)
at io.zenoh.Zenoh.(Zenoh.kt:161)
at io.zenoh.Zenoh.(Zenoh.kt)
at io.zenoh.Zenoh$Companion.load(Zenoh.kt:36)
at io.zenoh.Session.(Session.kt:90)
at io.zenoh.Session.(Session.kt)
at io.zenoh.Session$Companion.open(Session.kt:70)
at io.zenoh.Session.open(Session.kt)
at com.kernelsoft.zenoh.handler.ZenohSubHandler.subKey(ZenohSubHandler.java:64)
at com.kernelsoft.zenoh.handler.ZenohSubHandler.lambda$startZenohSub$0(ZenohSubHandler.java:48)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635)
at java.base/java.lang.Thread.run(Thread.java:833)

Copy link

PR missing one of the required labels: {'documentation', 'new feature', 'enhancement', 'internal', 'bug', 'breaking-change', 'dependencies'}

@huazai023 huazai023 changed the title resolve the issue of java.lang.NullPointerException in springboot jar bug: resolve the issue of java.lang.NullPointerException in springboot jar Sep 26, 2024
@huazai023 huazai023 changed the title bug: resolve the issue of java.lang.NullPointerException in springboot jar resolve the issue of java.lang.NullPointerException in springboot jar Sep 26, 2024
@DariusIMP DariusIMP added the bug Something isn't working label Sep 26, 2024
@gabrik gabrik requested a review from DariusIMP September 26, 2024 12:04
Copy link
Member

@DariusIMP DariusIMP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Let me further investigate this, because this solution has caused the native lib to fail to be loaded from external projects. Let's postpone the merge.

@Wjun-1
Copy link

Wjun-1 commented Nov 25, 2024

@huazai023 Hello, how did you integrate Zenoh into SpringBoot?

@huazai023
Copy link
Author

@huazai023 Hello, how did you integrate Zenoh into SpringBoot?

Add the following dependencies in POM
<dependency> <groupId>io.zenoh</groupId> <artifactId>zenoh-java-jvm</artifactId> <version>1.0.0-beta.1</version> <exclusions> <exclusion> <groupId>org.jetbrains.kotlinx</groupId> <artifactId>kotlinx-serialization-json-jvm</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>2.0.0</version>

There is a bug in the current version 1.0.0-beta. 1, please rely on the latest version

@Wjun-1
Copy link

Wjun-1 commented Nov 25, 2024

@huazai023 Hello, how did you integrate Zenoh into SpringBoot?

Add the following dependencies in POM <dependency> <groupId>io.zenoh</groupId> <artifactId>zenoh-java-jvm</artifactId> <version>1.0.0-beta.1</version> <exclusions> <exclusion> <groupId>org.jetbrains.kotlinx</groupId> <artifactId>kotlinx-serialization-json-jvm</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>2.0.0</version>

There is a bug in the current version 1.0.0-beta. 1, please rely on the latest version

Thanks, are you using maven? Is the imported package from my picture here
1

@huazai023
Copy link
Author

@huazai023 Hello, how did you integrate Zenoh into SpringBoot?您好,您是如何将 Zenoh 集成到 SpringBoot 中的?

Add the following dependencies in POM <dependency> <groupId>io.zenoh</groupId> <artifactId>zenoh-java-jvm</artifactId> <version>1.0.0-beta.1</version> <exclusions> <exclusion> <groupId>org.jetbrains.kotlinx</groupId> <artifactId>kotlinx-serialization-json-jvm</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>2.0.0</version>在 POM <dependency> <groupId>io.zenoh</groupId> <artifactId>zenoh-java-jvm</artifactId> <version>1.0.0-beta.1</version> <exclusions> <exclusion> <groupId>org.jetbrains.kotlinx</groupId> <artifactId>kotlinx-serialization-json-jvm</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>2.0.0</version> 中添加以下依赖项
There is a bug in the current version 1.0.0-beta. 1, please rely on the latest version当前版本 1.0.0-beta 中存在一个错误。1、请依赖最新版本

Thanks, are you using maven? Is the imported package from my picture here谢谢,您在使用 maven 吗?是从我的图片导入的包吗 1

yes

@Wjun-1
Copy link

Wjun-1 commented Nov 25, 2024

您好,您是如何将 Zenoh 集成到 SpringBoot 中的?您好,您是如何将 Zenoh 集成到 SpringBoot 中的?

在 POM 中添加以下依赖项 POM 中添加以下依赖项 There is a bug in the current version 1.0.0-beta.1、请依赖最新版本当前版本 1.0.0-beta 中存在一个错误。1、请依赖最新版本<dependency> <groupId>io.zenoh</groupId> <artifactId>zenoh-java-jvm</artifactId> <version>1.0.0-beta.1</version> <exclusions> <exclusion> <groupId>org.jetbrains.kotlinx</groupId> <artifactId>kotlinx-serialization-json-jvm</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>2.0.0</version>``<dependency> <groupId>io.zenoh</groupId> <artifactId>zenoh-java-jvm</artifactId> <version>1.0.0-beta.1</version> <exclusions> <exclusion> <groupId>org.jetbrains.kotlinx</groupId> <artifactId>kotlinx-serialization-json-jvm</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.jetbrains.kotlin</groupId> <artifactId>kotlin-stdlib</artifactId> <version>2.0.0</version>

谢谢,您在使用 maven 吗?是从我图片导入的包在这里谢谢,您在使用 maven 吗?是从我的图片导入的包吗1

是的

thanks

@Wjun-1
Copy link

Wjun-1 commented Nov 28, 2024

When using zenoh java jvm in springboot jar, the following error occurred:

java.lang.Exception: Unable to load Zenoh JNI: java.lang.NullPointerException at io.zenoh.Zenoh$Companion.tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:137) at io.zenoh.Zenoh$Companion.access$tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:29) at io.zenoh.Zenoh.(Zenoh.kt:161) at io.zenoh.Zenoh.(Zenoh.kt) at io.zenoh.Zenoh$Companion.load(Zenoh.kt:36) at io.zenoh.Session.(Session.kt:90) at io.zenoh.Session.(Session.kt) at io.zenoh.Session$Companion.open(Session.kt:70) at io.zenoh.Session.open(Session.kt) at com.kernelsoft.zenoh.handler.ZenohSubHandler.subKey(ZenohSubHandler.java:64) at com.kernelsoft.zenoh.handler.ZenohSubHandler.lambda$startZenohSub$0(ZenohSubHandler.java:48) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)

Excuse me, after you import the zenoh-java package, do you use a json file as a configuration file to configure the mode, multicast address, those parameters, like the line of my picture annotation to get the config variable and put it in Session.open()?
43dad6212ae5b10b012ac8e554f8129

@huazai023
Copy link
Author

When using zenoh java jvm in springboot jar, the following error occurred:
java.lang.Exception: Unable to load Zenoh JNI: java.lang.NullPointerException at io.zenoh.Zenoh$Companion.tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:137) at io.zenoh.Zenoh$Companion.access$tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:29) at io.zenoh.Zenoh.(Zenoh.kt:161) at io.zenoh.Zenoh.(Zenoh.kt) at io.zenoh.Zenoh$Companion.load(Zenoh.kt:36) at io.zenoh.Session.(Session.kt:90) at io.zenoh.Session.(Session.kt) at io.zenoh.Session$Companion.open(Session.kt:70) at io.zenoh.Session.open(Session.kt) at com.kernelsoft.zenoh.handler.ZenohSubHandler.subKey(ZenohSubHandler.java:64) at com.kernelsoft.zenoh.handler.ZenohSubHandler.lambda$startZenohSub$0(ZenohSubHandler.java:48) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)

Excuse me, after you import the zenoh-java package, do you use a json file as a configuration file to configure the mode, multicast address, those parameters, like the line of my picture annotation to get the config variable and put it in Session.open()? 43dad6212ae5b10b012ac8e554f8129

My usage scenario is relatively simple, without any configuration

@Wjun-1
Copy link

Wjun-1 commented Dec 16, 2024

When using zenoh java jvm in springboot jar, the following error occurred:
java.lang.Exception: Unable to load Zenoh JNI: java.lang.NullPointerException at io.zenoh.Zenoh$Companion.tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:137) at io.zenoh.Zenoh$Companion.access$tryLoadingLibraryFromJarPackage-IoAF18A(Zenoh.kt:29) at io.zenoh.Zenoh.(Zenoh.kt:161) at io.zenoh.Zenoh.(Zenoh.kt) at io.zenoh.Zenoh$Companion.load(Zenoh.kt:36) at io.zenoh.Session.(Session.kt:90) at io.zenoh.Session.(Session.kt) at io.zenoh.Session$Companion.open(Session.kt:70) at io.zenoh.Session.open(Session.kt) at com.kernelsoft.zenoh.handler.ZenohSubHandler.subKey(ZenohSubHandler.java:64) at com.kernelsoft.zenoh.handler.ZenohSubHandler.lambda$startZenohSub$0(ZenohSubHandler.java:48) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1136) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:635) at java.base/java.lang.Thread.run(Thread.java:833)

Excuse me, after you import the zenoh-java package, do you use a json file as a configuration file to configure the mode, multicast address, those parameters, like the line of my picture annotation to get the config variable and put it in Session.open()? 43dad6212ae5b10b012ac8e554f8129

My usage scenario is relatively simple, without any configuration

Thanks, is this bug solved?,I'm using springboot to type a jar package or report this error.,The reference is also the latest dependency.

@DariusIMP
Copy link
Member

This issue should be fixed now by https://github.com/eclipse-zenoh/zenoh-java/pull/162/files.

@DariusIMP DariusIMP closed this Dec 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants