spring - 无法解析 OpenID 配置 spring boot(安全)java.net.Co

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

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

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

  1. Unable to resolve the OpenID Configuration with the provided Issuer of "http://localhost:8090/uaa/oauth/token"
  2. 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

堆栈轨迹如下:

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 的新手。

最佳答案

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

你能检查一下你电脑上这个端口上是否有任何东西在运行吗? 如果有东西在这个端口上运行,应用程序会响应 404 或类似的东西。也许应用程序在启动时崩溃了,而您没有看到它?

关于spring - 无法解析 OpenID 配置 spring boot(安全)java.net.ConnectException : Connection refused: connect,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56983346/

相关文章:

python - 在多处理模块中使用 Pool 修改全局变量

reactjs - 如何将 MenuItem 用作 NavLink?

amazon-web-services - 为什么 Amazon Athena 会抛出 "Acces

python - 为什么 GridSearchCV 方法的精度低于标准方法?

angular - 自动滚动 onkeydown 即使没有必要

laravel - 安装后如何使用 npm 包 (chart.js)?

angular - 上传 PUT 请求由 Angular ServiceWorker 发送两次

r - 从 R Survey 包运行 svymean 时,我可以得到 unwtd.count 吗?

node.js - 事件.js :180 throw er;//Unhandled 'error'

assembly - 如何在 GDB 控制台中设置 "info registers"中的变量 rip