Springboot Oauth2:org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator $ UnauthorizedException

时间:2018-05-28 14:18:23

标签: spring-boot spring-security jackson spring-security-oauth2

我正在尝试实现功能齐全的Spring-boot oauth2。我设法使用成功凭证实现登录,使用/oauth/token

我使用access_token和refresh_token获得正确的响应

使用正确的用户名和密码

{
"access_token": "b8c45984-c573-4837-9ef6-6896f308a286",
"token_type": "bearer",
"refresh_token": "48145463-830e-4467-ab89-587bda6b32de",
"expires_in": 43199,
"scope": "read write"

}

如果我使用错误的用户名,它会给我一个正确的错误,我很高兴;

错误的用户名:

{error: "unauthorized", error_description: "No value present"}

错误 : “山寨版” ERROR_DESCRIPTION : “没有价值”

但是当我使用正确的用户名和错误的密码时问题就出现了;我得到以下错误

2018-05-28 14:47:25.264  WARN 6604 --- [nio-8088-exec-2] .c.j.MappingJackson2HttpMessageConverter : 
Failed to evaluate Jackson serialization for type [class     org.springframework.security.oauth2.provider.error.DefaultWebResponseExceptionTranslator$UnauthorizedException]:
 org.springframework.beans.factory.BeanCreationException: Error creating bean with name     'org.springframework.security.oauth2.common.exceptions.OAuth2ExceptionJackson2Serializer': 
 BeanPostProcessor before instantiation of bean failed; 
 nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name
 'org.springframework.transaction.config.internalTransactionAdvisor' defined in class path resource
 [org/springframework/transaction/annotation/ProxyTransactionManagementConfiguration.class]: 
 Bean instantiation via factory method failed; 
 nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate      [org.springframework.transaction.interceptor.BeanFactoryTransactionAttributeSourceAdvisor]: 
 Factory method 'transactionAdvisor' threw exception; 
 nested exception is java.lang.NullPointerException

0 个答案:

没有答案