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

[Native Image] -Dsun.security.jgss.native=true is not getting set in native image #9778

Closed
2 tasks
yogeshkumargeek opened this issue Sep 29, 2024 · 3 comments
Closed
2 tasks
Assignees

Comments

@yogeshkumargeek
Copy link

yogeshkumargeek commented Sep 29, 2024

Describe the Issue

Hi graalvm team,

We are trying to build a graalvm native image of our application from micronaut.

While executing the Kerberos authentication --> we are seeing the following error
where the GSSContext is not getting instantiated
It seems -Dsun.security.jgss.native=true this property is not getting set in the native image

micronautVersion=4.6.2
kotlinVersion=1.9.25

Using the latest version of GraalVM can resolve many issues.

GraalVM Version

OpenJDK Runtime Environment GraalVM CE 21.0.2+13.1

Operating System and Version

linux

Diagnostic Flag Confirmation

  • I tried the -H:ThrowMissingRegistrationErrors= flag.

Run Command

./gradlew nativeCompile

Expected Behavior

Expect sun.security.jgss.native flag to set as true

Actual Behavior

Actual behavior should be GSSContext should return an instance while calling it

Steps to Reproduce

Use this build args

buildArgs.add('--verbose')
buildArgs.add('--strict-image-heap')
buildArgs.add('--add-opens java.base/java.lang=ALL-UNNAMED') //for reflection
buildArgs.add('--enable-native-access')
buildArgs.add('-Dsun.security.jgss.native=true')
buildArgs.add('-H:AdditionalSecurityProviders=sun.security.jgss.SunProvider')
buildArgs.add('-H:IncludeResourceBundles=sun.security.util.Resources')
buildArgs.add('-H:+EnableSecurityServicesFeature')

Additional Context

This is the warning received while running nativeCompile command
WARNING: Unknown module: -Dsun.security.jgss.native=true specified to --enable-native-access

Run-Time Log Output and Error Messages

14:13:25.234 [default-nioEventLoopGroup-1-2] ERROR i.m.http.server.RouteExecutor - Unexpected error occurred: null
java.lang.NullPointerException: null
at java.security.jgss@21.0.2/sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:339)
at java.security.jgss@21.0.2/sun.security.jgss.GSSContextImpl.acceptSecContext(GSSContextImpl.java:303)

@yogeshkumargeek
Copy link
Author

Hi @selhagani , Can you help with this issue ?

@oubidar-Abderrahim
Copy link
Member

Thank you for reaching out, if you use native-image --help you can see the following

 --enable-native-access               <module name>[,<module name>...]
                                                     modules that are permitted to perform restricted native operations.
                                                     <module name> can also be ALL-UNNAMED.

so when you specify --enable-native-access as an argument, the following argument is expected to be the module name, yet it finds -Dsun.security.jgss.native=true which is not a valid module name, hence the error: WARNING: Unknown module: -Dsun.security.jgss.native=true specified to --enable-native-access

@oubidar-Abderrahim oubidar-Abderrahim closed this as not planned Won't fix, can't repro, duplicate, stale Oct 1, 2024
@yogeshkumargeek
Copy link
Author

Hi @oubidar-Abderrahim , Even after removing --enable-native-access , Gss Context is not getting initialized and seeing the same null pointer exception stated earlier .
Please help in fixing that

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

No branches or pull requests

2 participants