工厂方法“jwtAccessTokenConverter”引发了异常;嵌套的异常是java.lang.IllegalArgumentException:

nhn9ugyo  于 2022-11-20  发布在  Java
关注(0)|答案(1)|浏览(590)

这是一个在 Spring 构建过程中出现的错误。我将现有源代码的差异更改为mariaDB -〉mysqlDB。我想知道为什么会出现这个错误。

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.security.oauth2.config.annotation.web.configuration.AuthorizationServerEndpointsConfiguration': Invocation of init method failed; nested exception is java.lang.IllegalStateException: Cannot configure enpdoints
  
Caused by: java.lang.IllegalStateException: Cannot configure enpdoints
  
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tokenStore' defined in class path resource [me/sun/springbootstudy/config/oauth/AuthorizationServer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.TokenStore]: Factory method 'tokenStore' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAccessTokenConverter' defined in class path resource [me/sun/springbootstudy/config/oauth/AuthorizationServer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'jwtAccessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
 
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.TokenStore]: Factory method 'tokenStore' threw exception; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAccessTokenConverter' defined in class path resource [me/sun/springbootstudy/config/oauth/AuthorizationServer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'jwtAccessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
    
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jwtAccessTokenConverter' defined in class path resource [me/sun/springbootstudy/config/oauth/AuthorizationServer.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'jwtAccessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
  
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.security.oauth2.provider.token.store.JwtAccessTokenConverter]: Factory method 'jwtAccessTokenConverter' threw exception; nested exception is java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
 
Caused by: java.lang.IllegalArgumentException: [Assertion failed] - this String argument must have text; it must not be null, empty, or blank
lf5gs5x2

lf5gs5x21#

我把你问题分成两部分。
Bean示例化异常
当Bean示例化失败时引发此exception。包含有问题的Bean类。更具体地说,IOC在创建在类路径资源[.../springbootstudy/config/oauth/AuthorizationServer.class中定义的名为'jwtAccessTokenConverter'的Bean时遇到错误。
JwtAccessToken转换器
它在JWT编码的标记值和OAuth验证信息之间进行转换(双向)。在授予标记时,它还充当TokenEnhancer。此外,日志转换器建议jwtAccessTokenConverter中的字符串参数(请阅读字段sumery)必须包含文本;它不能为null、空或空白。这可能是由于缺少配置造成,但需要更多调试详细信息。

相关问题