-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Native image creation fails with java.lang.NoClassDefFoundError: com/sun/jna/LastErrorException #6327
Comments
Not sure if it helps - having the same issue - I could narrow it down to make it work when I don't use the Postgres extended types from 'com.vladmihalcea:hibernate-types-52' library. For me adding this dependency breaks the native build. |
@michael-schnell could you try with the latest 1.2.0.Final and GraalVM 19.3.1? |
@gsmet Unfortunately problem stays the same with Quarkus 1.2.0.Final and GraalVM 19.3.1
As before it works fine with Maria DB settings:
|
@wfrank2509 The library 'com.vladmihalcea:hibernate-types-52' is not in the dependency hierarchy. |
Hi ... yes sure, but if you want to use Postgres Features like the JSONB type you need a library like that. The one mentioned is very commonly used. And that breaks when used in native build ... |
My understanding is that something is trying to delete the You have a lot of dependencies so it's a bit hard to know who. I looked at the Quarkus source code and I don't see anything related to that class. @dmlloyd any idea how we could debug that one? |
We'd have to start by figuring out what requires JNA. The |
As a workaround, I've found that you can create the class in your own project, extending it from |
As another workaround, native-image configuration <dependency>
<groupId>jakarta.security.jacc</groupId>
<artifactId>jakarta.security.jacc-api</artifactId>
</dependency>
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
</dependency> |
Is there a fix in sight? |
@antonwiens Are you facing the same problem with your code? Unfortunately I haven't had the time to check the above mentioned workarounds for my project. |
I face the same problem with my code. When using reportErrorsAtRuntime, suddenly the two mentioned dependencies are required. EDIT: Quarkus 1.7.3 and Graalvm 20.1.0 |
Hello @antonwiens, is there a simple application you can share (preferably as a github repo) which reproduces this issue? |
I will try to create one. |
Still happening with Quarkus 1.11.1.Final and latest GraalVM 21.1.0-dev. As mentioned above, adding a dependency for JNA fixes the problem:
|
I could reproduce this issue and I had to add this additional dependency to make it work: <dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna-platform</artifactId>
<version>5.3.1</version>
</dependency> Note that this dependency is not under quarkus bom, so I had to manually set the version. |
An explanation of why this is happening can be found in oracle/graal#1725 As explained there:
So manually adding the dependencies might work around the issue and might be acceptable for development purposes but production code should not use |
Is this still an issue? |
I didn't try it again yet. |
Hi! Not really relevant anymore for me. |
Closing |
Using the "quarkus-jdbc-postgresql" extension fails with the below error. Changing the database to "quarkus-jdbc-mariadb" fixes the problem. So it seems clearly to be related only to the postgresql extension.
Expected behavior
Native image creation should work with "quarkus-jdbc-postgresql" as it does with "quarkus-jdbc-mariadb".
Actual behavior
Native image creation fails with "--report-unsupported-elements-at-runtime" and also without this parameter for "quarkus-jdbc-postgresql". Same project setup works fine with "quarkus-jdbc-mariadb".
To Reproduce
Steps to reproduce the behavior:
Environment (please complete the following information):
Additional context
There was a similar issue #796, but I do not use the "shamrock-maven-plugin" as mentioned in that old issue.
The text was updated successfully, but these errors were encountered: