0

We are migrating our Java application from Java 8 to 11. We bundle the jre inside the application using install4j version 7.0.10. The jre bundle for java11 is created using install4j app (Project --> Create a JRE Bundle)

When we try to login into application, we get below error and login fails. javax.security.auth.login.LoginException: No LoginModule found for newco.connectivity.PublicAuthenticatorLoginModule at javax.security.auth.login.LoginContext.invoke(LoginContext.java:731) ~[?:?] at javax.security.auth.login.LoginContext$4.run(LoginContext.java:672) ~[?:?] at javax.security.auth.login.LoginContext$4.run(LoginContext.java:670) ~[?:?] at java.security.AccessController.doPrivileged(Native Method) ~[?:?] at javax.security.auth.login.LoginContext.invokePriv(LoginContext.java:670) ~[?:?] at javax.security.auth.login.LoginContext.login(LoginContext.java:581) ~[?:?] at newco.connectivity.NewcoExecutionContext.sendLoginRequest(NewcoExecutionContext.java:398) ~[connectivity.jar:?] at newco.connectivity.NewcoExecutionContext.doLogin(NewcoExecutionContext.java:308) ~[connectivity.jar:?] at newco.connectivity.NewcoExecutionContext.doConnect(NewcoExecutionContext.java:256) ~[connectivity.jar:?] at newco.connectivity.NewcoExecutionContext.connect(NewcoExecutionContext.java:233) ~[connectivity.jar:?] at newco.connectivity.connection.DefaultServerConnection.start(DefaultServerConnection.java:147) [connectivity.jar:?] at newco.net.connectmgr.RMIServerConnection$2.call(RMIServerConnection.java:73) [client.jar:?] at newco.net.connectmgr.RMIServerConnection$2.call(RMIServerConnection.java:72) [client.jar:?] at com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125) [guava-28.2-jre.jar:?] at com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:69) [guava-28.2-jre.jar:?] at com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78) [guava-28.2-jre.jar:?] at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426) [?:?] at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290) [?:?] at java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020) [?:?] at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656) [?:?] at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594) [?:?] at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183) [?:?]

I have verified that newco.connectivity.PublicAuthenticatorLoginModule exists in the package. JRE bundle version is 11.0.10

Ken White
  • 123,280
  • 14
  • 225
  • 444
Shivom
  • 1
  • According to https://stackoverflow.com/a/16643919/936832 you need to set `-Djava.security.auth.login.config` to point to a config file where the login modules are specified. Could there be any problem with that? – Ingo Kegel Mar 21 '23 at 09:15
  • This is a desktop APP which is packaged using install4j and installed on the desktop using .exe file. java.security.auth.login.config is set programmatically in the code. Older application which is on java8 works fine. Just want to mention that we are now using openJDK (Azul Zulu 11) for creating the jreBundle. Could this be a problem? – Shivom Mar 21 '23 at 21:21
  • `java.security.auth.login.config is set programmatically in the code` -> Try setting it as a fixed VM parameter. The JRE version should not matter. – Ingo Kegel Mar 22 '23 at 21:20

1 Answers1

0

The issue was happening due to change in ForkJoinPool.commonPool() implementation in Java11.

In Java 8, the ForkJoinPool uses subclass of URLClassLoader to load the contextClassLoader.

In Java11, the forkJoin pool uses ClassLoaders$AppClassLoader to load contextClassLoader.

So, the contextClassLoader was not loading the application specific jars.

John Rotenstein
  • 241,921
  • 22
  • 380
  • 470
Shivom
  • 1