在开发一个Sping Boot 应用程序的时候,我们使用了keycloak,当使用vscode中嵌入的tomcat启动它时,一切都正常工作。
在部署的时候,我们希望把它放在一个独立的tomcat服务器上,所以我们复制了war文件,应用程序启动了,我们得到了一个到keycloak服务器的重定向,在完成登录后,重定向回页面工作正常。
在加载页面时,我们得到以下错误:
20-Aug-2021 13:15:31.341 SCHWERWIEGEND [http-nio-8080-exec-10] org.apache.catalina.core.StandardHostValve.invoke Exception Processing /myapplicationpath/
java.util.ServiceConfigurationError: org.keycloak.adapters.authorization.ClaimInformationPointProviderFactory: org.keycloak.adapters.authorization.cip.ClaimsInformationPointProviderFactory not a subtype
at java.base/java.util.ServiceLoader.fail(ServiceLoader.java:590)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNextService(ServiceLoader.java:1237)
at java.base/java.util.ServiceLoader$LazyClassPathLookupIterator.hasNext(ServiceLoader.java:1265)
at java.base/java.util.ServiceLoader$2.hasNext(ServiceLoader.java:1300)
at java.base/java.util.ServiceLoader$3.hasNext(ServiceLoader.java:1385)
at org.keycloak.adapters.authorization.PolicyEnforcer.loadClaimInformationPointProviders(PolicyEnforcer.java:134)
at org.keycloak.adapters.authorization.PolicyEnforcer.<init>(PolicyEnforcer.java:87)
at org.keycloak.adapters.KeycloakDeploymentBuilder$1.call(KeycloakDeploymentBuilder.java:154)
at org.keycloak.adapters.KeycloakDeploymentBuilder$1.call(KeycloakDeploymentBuilder.java:147)
at org.keycloak.adapters.KeycloakDeployment.getPolicyEnforcer(KeycloakDeployment.java:537)
at org.keycloak.adapters.AuthenticatedActionsHandler.isAuthorized(AuthenticatedActionsHandler.java:150)
at org.keycloak.adapters.AuthenticatedActionsHandler.handledRequest(AuthenticatedActionsHandler.java:60)
at org.keycloak.adapters.tomcat.AbstractAuthenticatedActionsValve.invoke(AbstractAuthenticatedActionsValve.java:62)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:607)
at org.keycloak.adapters.tomcat.AbstractKeycloakAuthenticatorValve.invoke(AbstractKeycloakAuthenticatorValve.java:181)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:139)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:92)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:678)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:343)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:408)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:853)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1587)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)
at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.base/java.lang.Thread.run(Thread.java:835)
这是我们当前的keycloak.json文件:
{
"realm": "realmname",
"auth-server-url": "https://ourkeycloakserver.com/auth/",
"ssl-required": "none",
"resource": "clientname",
"verify-token-audience": true,
"credentials": {
"secret": "secret"
},
"use-resource-role-mappings": true,
"confidential-port": 0,
"policy-enforcer": {}
}
知道我们应该看什么吗?keycloak配置在我们的www.example.com中application.properties,它可以很好地与嵌入式tomcat一起工作。
2条答案
按热度按时间bvn4nwqk1#
我和你有同样的问题,我发现我用的是tomcat keycloak适配器,但是我也在
pom.xml
中导入了springboot-keycloak-adapter,我在我的pom.xml
中删除了这个,再次打包,deploy.my
程序工作正常...也许你可以去看看。ymzxtsji2#
组织.密钥罩.适配器.授权.cip.声明信息点提供程序工厂不是子类型
这意味着类ClaimsInformationPointProviderFactory在tomcat和应用程序中的加载方式不同/存在冲突。此问题的解决方案是检查tomcat/lib中的jar并将其删除,然后重新启动服务器