Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.6k views
in Technique[技术] by (71.8m points)

spring boot - KeyCloak Server Caused by: java.lang.ClassNotFoundException: java.security.acl.Group

I'm running a KeyCloak server to authenticate users who would like to gain access to a Spring Boot/Spring Web REST API. However, an error occurs while trying to authenticate.

The following works:

  • When I access http://localhost:8080/path/to/restapi
  • I get presented with a login screen as expected: -- KeyCloak Login Screen
  • When I click login the following error occurs on the redirect from within my browser:

Whitelabel Error Page This application has no explicit mapping for /error, so you are seeing this as a fallback.

This is the error that's printed to the Spring Boot console:

Caused by: java.lang.ClassNotFoundException: java.security.acl.Group
  at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602) ~[na:na]
  at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178) ~[na:na]
  at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522) ~[na:na]
  ... 33 common frames omitted

The KeyCloak server shows that the session is active for the user to the application. However, the authenication process is never completed due to the above missing class.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

After some research I found the answer to my problem.

The problem is that java.security.acl.Group is being deprecated since JRE 9 and marked for removal in future versions.

java.security.acl.Group is being replaced by java.security.Policy

I was running my Spring-Boot application on JRE 14 in which this class appeared to be no longer available.

So once I changed my Spring-boot application (which hosts the REST-API) to use JRE 11 the error went away.

Note: The pom.xml Java version attibute <java.version>11</java.version> needed to change as well as the JDK in the build path in Eclipse (which is the IDE I'm using) JDK Buildpath


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...