KeyCloak服务器原因:java.lang.ClassNotFoundException:java.security.acl.Group [英] KeyCloak Server Caused by: java.lang.ClassNotFoundException: java.security.acl.Group

查看:677
本文介绍了KeyCloak服务器原因:java.lang.ClassNotFoundException:java.security.acl.Group的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在运行KeyCloak服务器,以对希望访问Spring Boot / Spring Web REST API的用户进行身份验证。但是,尝试进行身份验证时会出错。

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.

以下工作原理:


  • 当我访问<$ c $时c> http:// localhost:8080 / path / to / restapi

  • 我得到了预期的登录屏幕:
    -< a href = https://i.stack.imgur.com/JQdUw.png rel = nofollow noreferrer> KeyCloak登录屏幕

  • 当我单击登录时,从我的浏览器中进行重定向时发生以下错误:


Whitelabel错误页面
此应用程序没有显式映射

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

这是打印到Spring Boot控制台的错误:

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

KeyCloak服务器显示该会话对用户来说是活动的。但是,由于缺少上述类,因此身份验证过程从未完成。

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.

推荐答案

经过一番研究,我找到了解决问题的方法

After some research I found the answer to my problem.

问题是自JRE 9开始不推荐使用java.security.acl.Group并将其标记为在以后的版本中删除。

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替换为java.security.Policy

我在JRE 14上运行Spring-Boot应用程序

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

因此,一旦我将Spring-boot应用程序(托管REST-API)更改为使用JRE 11,错误就会消失。

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


注意:pom.xml Java版本属性< java.version> 11< /java.version> 以及Eclipse(我正在使用的IDE)的构建路径中的JDK都需要更改 JDK Buildpath

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

这篇关于KeyCloak服务器原因:java.lang.ClassNotFoundException:java.security.acl.Group的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆