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

Caused by: java.lang.RuntimeException: java.lang.NoClassDefFoundError: ai.onnxruntime.OrtSession$SessionOptions #8752

Open
yongxin3344520 opened this issue Apr 11, 2024 · 2 comments
Assignees
Labels

Comments

@yongxin3344520
Copy link

=============
win10 , java21

I used GraalVM 21 to package my project, which introduced the onnxruntime jar.

<plugin>
      <groupId>org. galalvm. buildtools</groupId>
      <artifactId>native aven plugin</artifactId>
      <configuration>
      <buildArgs>
      <arg>- H:+AllowDeprecatedBuilderClassesOnImageClasspath</arg>
      </buildArgs>
</configuration>
</plugin>

After successful packaging, run exe with an exception: Caused by: Java. lang. RuntimeException: Java. lang. NoClassDefFoundError: ai. onnxruntime OrtSession $SessionOptions.

======================

If commented out:
- H:+AllowDeprecatedBuilderClassesOnImageClasspath
When using the command: mvn - Native Native Native: compile to package as exe, an error will be reported: Error: Class path entry file:///F:/B/yolo_tiny/target/classes/ Contains class ai.onnxruntime MapInfo This class is part of the image builder itself (in file:///D:/java/graalvm -Jdk-21.0.2+13.1/lib/svm/builder/svm enterprise. jar) and must not be passed via cp. This can be caused by a fat jar that Illegally includes svm. jar (or grain sdk. jar) due to its build time dependency on it. As a workaround, - H:+AllowDeprecatedBuilderClassesOnImageClasspath allows turning this error into a warning Note that this option is deprecated and will be removed in a future version 。

How should I handle it, may I ask? thanks!

@fernando-valdez fernando-valdez self-assigned this Apr 12, 2024
@fernando-valdez
Copy link
Member

Hi.
To understand the issue, please provide the following information:

  • The exact version of GraalVM, that will be the full output of java -version
  • A minimal reproducer that we can use to get the same error locally.
  • The steps you followed to get this error.

@Taymindis
Copy link

Just setup your reflection.json config will fix the issue

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

3 participants