问题描述
我目前正在尝试仅使用Spring Boot应用程序来获取Keycloak载体.我已经关注了文档,但是当我尝试击中任何端点时,我仍然收到NoSuchMethodError.似乎与此密钥泄漏问题类似.基于此,它似乎应该可以在所有最新版本中使用.我遵循了本教程大部分.
I'm currently trying to get Keycloak bearer only to work with a spring boot application. I've followed the docs but I continue to get a NoSuchMethodError when I try to hit any of my endpoints. It seems similar to this keycloak issue. Based on that it looks like it should be working in all of the latest builds.I've followed this tutorial for the most part.
我有一个项目此处供参考. ( POM , KeycloakConfiguration )
I have the project here for reference. (POM, KeycloakConfiguration)
使用mvn spring-boot:run
碰到任何路线(在本例中为http://localhost:5767/health
)时,我都会收到此错误:
When hitting any route (in this example http://localhost:5767/health
) I get this error:
{
"timestamp": 1514942790219,
"status": 500,
"error": "Internal Server Error",
"exception": "java.lang.NoSuchMethodError",
"message": "java.lang.NoSuchMethodError: org.eclipse.jetty.server.Request.getSessionManager()Lorg/eclipse/jetty/server/SessionManager;",
"path": "/health"
}
在应用程序控制台中打印以下:
Which prints the following in the app's console:
2018-01-02 19:22:35.926 INFO 6201 --- [ main] com.ringofstorms.jservice.Application : Started Application in 9.381 seconds (JVM running for 13.906)
2018-01-02 19:26:30.176 WARN 6201 --- [tp1664999292-17] org.eclipse.jetty.server.HttpChannel : /health
java.lang.NoSuchMethodError: org.eclipse.jetty.server.Request.getSessionManager()Lorg/eclipse/jetty/server/SessionManager;
at org.keycloak.adapters.jetty.KeycloakJettyAuthenticator.createSessionManagement(KeycloakJettyAuthenticator.java:66) ~[spring-boot-container-bundle-3.4.1.Final.jar:3.4.1.Final]
at org.keycloak.adapters.jetty.core.AbstractKeycloakJettyAuthenticator.validateRequest(AbstractKeycloakJettyAuthenticator.java:292) ~[spring-boot-container-bundle-3.4.1.Final.jar:3.4.1.Final]
at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:483) ~[jetty-security-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:190) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1595) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:188) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1253) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:168) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:473) ~[jetty-servlet-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1564) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:166) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1155) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:132) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.Server.handle(Server.java:561) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:334) ~[jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:251) [jetty-server-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:279) [jetty-io-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:104) [jetty-io-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.io.ChannelEndPoint$2.run(ChannelEndPoint.java:124) [jetty-io-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:679) [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914]
at org.eclipse.jetty.util.thread.QueuedThreadPool$2.run(QueuedThreadPool.java:597) [jetty-util-9.4.7.v20170914.jar:9.4.7.v20170914]
at java.lang.Thread.run(Thread.java:745) [na:1.8.0_111]
使用Keycloak-3.4.2.Final(Ran与./Keycloak-3.4.2.Final/bin/standalone
)这是我当前的Maven依赖树.和当前环境(有关依赖版本,请参见回购中的POM)
Using Keycloak-3.4.2.Final (Ran with ./Keycloak-3.4.2.Final/bin/standalone
)Here is my current maven dependency tree.And current environment (Refer to POM in repo for dependency versions)
现在您可以看到我有keycloak-spring-security-adapter
依赖性已被注释掉,并且正试图仅进行安全性通过application.yaml 类似于教程在引入适配器和Java配置(也已注释掉).
Right now you can see I have the keycloak-spring-security-adapter
depdenency commented out, and am attempting to just do the security through the application.yaml like the tutorial does BEFORE it introduces the adapter and java configuration (which is also commented out).
我是否错过了一些与Jetty版本有关的奇怪的依赖冲突?依赖树中的所有Jetty版本都是相同的.因此,我对造成此问题的原因感到迷茫.
Am I missing some weird depdency conflict with Jetty versions? All the Jetty versions in the depdency tree are the same. So I am a bit lost on what is casuing this issue.
我想要的行为是在所有路由上获取403,除非我通过正在使用的任何客户端的标头传递有效的承载令牌.
My desired behavior is to get 403's on all routes unless I pass a valid bearer token through the headers from whatever client I am using.
推荐答案
这似乎是依赖性冲突.版本9.4.7的org.eclipse.jetty.server
中的Request
类没有方法getSessionManager()
.请参见此处.而在早期版本中, 9.3.2 ,此方法已存在.
It appears to be a dependency conflict. The Request
class in org.eclipse.jetty.server
of version 9.4.7 doesn't have a method getSessionManager()
. See here. Whereas, in the earlier version 9.3.2, this method was present.
那么,您可以尝试使用9.3.2版本的Jetty吗?
So,Can you try by using 9.3.2 version of Jetty?
这篇关于带有春季启动NoSuchMethodError的密钥斗篷org.eclipse.jetty.server.Request.getSessionManager()Lorg/eclipse/jetty/server/SessionManager的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!