【问题标题】:Unable to resolve the OpenID Configuration spring boot (security) java.net.ConnectException: Connection refused: connect无法解析 OpenID 配置 spring boot (security) java.net.ConnectException: Connection denied: connect
【发布时间】:2019-11-20 19:51:12
【问题描述】:

我正在学习 Spring Security,并试图运行这个项目,但它给了我一个错误。

我无法理解该怎么做。这是我正在关注的 Github link、Youtube 视频 [链接] (https://www.youtube.com/watch?v=1N-xwmoN83w)。

当我尝试运行客户端应用程序时,它运行良好,但是当我尝试运行资源服务器时它没有运行,它给了我错误:

  1. 无法使用提供的“http://localhost:8090/uaa/oauth/token”颁发者解析 OpenID 配置
  2. “http://localhost:8090/uaa/oauth/token/.well-known/openid-configuration”的 GET 请求出现 I/O 错误: 连接被拒绝:连接;嵌套异常是 java.net.ConnectException:连接被拒绝:连接

堆栈跟踪如下:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'springSecurityFilterChain' defined in class path resource [org/springframework/security/config/annotation/web/configuration/WebSecurityConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.servlet.Filter]: Factory method 'springSecurityFilterChain' threw exception; nested exception is java.lang.IllegalArgumentException: Unable to resolve the OpenID Configuration with the provided Issuer of "http://localhost:8090/uaa/oauth/token"
    at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:624) ~[spring-beans-5.1.0.RC3.jar:5.1.0.RC3]
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:455) ~[spring-beans-5.1.0.RC3.jar:5.1.0.RC3]
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1282) ~[spring-beans-5.1.0.RC3.jar:5.1.0.RC3]

Caused by: java.lang.IllegalArgumentException: Unable to resolve the OpenID Configuration with the provided Issuer of "http://localhost:8090/uaa/oauth/token"
    at org.springframework.security.oauth2.jwt.JwtDecoders.getOpenidConfiguration(JwtDecoders.java:78) ~[spring-security-oauth2-jose-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    at org.springframework.security.oauth2.jwt.JwtDecoders.fromOidcIssuerLocation(JwtDecoders.java:48) ~[spring-security-oauth2-jose-5.1.0.RELEASE.jar:5.1.0.RELEASE]

Caused by: org.springframework.web.client.ResourceAccessException: I/O error on GET request for "http://localhost:8090/uaa/oauth/token/.well-known/openid-configuration": Connection refused: connect; nested exception is java.net.ConnectException: Connection refused: connect
    at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:743) ~[spring-web-5.1.0.RC3.jar:5.1.0.RC3]
    at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:646) ~[spring-web-5.1.0.RC3.jar:5.1.0.RC3]
    at org.springframework.security.oauth2.jwt.JwtDecoders.getOpenidConfiguration(JwtDecoders.java:76) ~[spring-security-oauth2-jose-5.1.0.RELEASE.jar:5.1.0.RELEASE]
    ... 43 common frames omitted
Caused by: java.net.ConnectException: Connection refused: connect
    at java.net.DualStackPlainSocketImpl.connect0(Native Method) ~[na:1.8.0_181]
    at java.net.DualStackPlainSocketImpl.socketConnect(Unknown Source) ~[na:1.8.0_181]
    at java.net.AbstractPlainSocketImpl.doConnect(Unknown Source) ~[na:1.8.0_181]
    at java.net.AbstractPlainSocketImpl.connectToAddress(Unknown Source) ~[na:1.8.0_181]
    at java.net.AbstractPlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_181]
    at java.net.PlainSocketImpl.connect(Unknown Source) ~[na:1.8.0_181]
    at java.net.SocksSocketImpl.connect(Unknown Source) ~[na:1.8.0_181]
    at java.net.Socket.connect(Unknown Source) ~[na:1.8.0_181]

请帮我解决这个错误,我是 Spring Security 新手。

【问题讨论】:

    标签: spring spring-boot spring-security oauth-2.0 jwt


    【解决方案1】:

    似乎一个应用程序应该在端口 8090 上运行,但它没有(这是 I/O 错误的来源)。

    您能检查一下您计算机上的此端口上是否有任何东西在运行吗? 如果此端口上正在运行某些东西,则应用程序将响应 404 或类似的东西。也许应用程序在启动时崩溃而您没有看到它?

    【讨论】:

    • 不,我检查了这些端口上没有运行其他任何东西,所以感谢您的建议,请告诉我您是否有 Java 经验(Spring 和休眠)我需要您的帮助和建议,您可以也给我发邮件--> ag.rajat113@gmail.com
    猜你喜欢
    • 2019-09-13
    • 2017-10-14
    • 2016-06-28
    • 2014-02-09
    • 2017-12-16
    • 2015-12-30
    • 1970-01-01
    • 2015-02-09
    • 2014-07-25
    相关资源
    最近更新 更多