I have two services
account-service
auth-service
It's working fine when using InMemoryTokenStore.
Got those exception when using JwtTokenStore
2018-06-07 06:42:06.752 DEBUG [account-service,bb98d674cce28cb2,f16ee9710dda4948,true] 10 --- [-auth-service-3] o.s.c.s.i.w.c.feign.TracingFeignClient : Handled send of RealSpan(bb98d674cce28cb2/57a86735d62783ec)
2018-06-07 06:42:06.752 DEBUG [account-service,bb98d674cce28cb2,57a86735d62783ec,true] 10 --- [-auth-service-3] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@3a0a7fce12 pairs: {POST /uaa/users HTTP/1.1: null}{Authorization: Bearer 025d1b78-ddfe-4767-9f74-ccbd1cb74fa6}{X-B3-SpanId: f16ee9710dda4948}{X-B3-ParentSpanId: b72e428a8d17a487}{X-B3-Sampled: 1}{X-B3-TraceId: bb98d674cce28cb2}{Content-Type: application/json;charset=UTF-8}{Accept: */*}{User-Agent: Java/1.8.0_171}{Host: 10.42.217.26:5000}{Connection: keep-alive}{Content-Length: 49}
2018-06-07 06:42:06.755 DEBUG [account-service,bb98d674cce28cb2,57a86735d62783ec,true] 10 --- [-auth-service-3] s.n.www.protocol.http.HttpURLConnection : sun.net.www.MessageHeader@4b226cf910 pairs: {null: HTTP/1.1 401}{Cache-Control: no-store}{Pragma: no-cache}{WWW-Authenticate: Bearer realm="oauth2-resource", error="invalid_token", error_description="Cannot convert access token to JSON"}{X-Content-Type-Options: nosniff}{X-XSS-Protection: 1; mode=block}{X-Frame-Options: DENY}{Content-Type: application/json;charset=UTF-8}{Transfer-Encoding: chunked}{Date: Thu, 07 Jun 2018 06:42:06 GMT}
2018-06-07 06:42:06.756 DEBUG [account-service,bb98d674cce28cb2,f16ee9710dda4948,true] 10 --- [-auth-service-3] o.s.c.s.i.w.c.feign.TracingFeignClient : Handled receive of RealSpan(bb98d674cce28cb2/57a86735d62783ec)
2018-06-07 06:42:06.756 DEBUG [account-service,bb98d674cce28cb2,b72e428a8d17a487,true] 10 --- [-auth-service-3] o.s.c.s.i.w.c.feign.TracingFeignClient : Handled receive of RealSpan(bb98d674cce28cb2/f16ee9710dda4948)
2018-06-07 06:42:06.758 DEBUG [account-service,bb98d674cce28cb2,b72e428a8d17a487,true] 10 --- [-auth-service-3] com.netflix.hystrix.AbstractCommand : Error executing HystrixCommand.run(). Proceeding to fallback logic ...
feign.FeignException: status 401 reading AuthServiceClient#createUser(User)
at feign.FeignException.errorStatus(FeignException.java:62) ~[feign-core-9.5.1.jar!/:na]
at feign.codec.ErrorDecoder$Default.decode(ErrorDecoder.java:91) ~[feign-core-9.5.1.jar!/:na]
at feign.SynchronousMethodHandler.executeAndDecode(SynchronousMethodHandler.java:138) ~[feign-core-9.5.1.jar!/:na]
at feign.SynchronousMethodHandler.invoke(SynchronousMethodHandler.java:76) ~[feign-core-9.5.1.jar!/:na]
at feign.hystrix.HystrixInvocationHandler$1.run(HystrixInvocationHandler.java:108) ~[feign-hystrix-9.5.1.jar!/:na]
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:302) ~[hystrix-core-1.5.12.jar!/:1.5.12]
at com.netflix.hystrix.HystrixCommand$2.call(HystrixCommand.java:298) ~[hystrix-core-1.5.12.jar!/:1.5.12]
at rx.internal.operators.OnSubscribeDefer.call(OnSubscribeDefer.java:46) [rxjava-1.3.8.jar!/:1.3.8]
2018-06-07 05:09:54.311 DEBUG [auth-service,6ad148d1ce54b72f,d9b82e389487d782,true] 1 --- [nio-5000-exec-9] o.s.s.web.util.matcher.OrRequestMatcher : No matches found
2018-06-07 05:09:54.311 DEBUG [auth-service,6ad148d1ce54b72f,d9b82e389487d782,true] 1 --- [nio-5000-exec-9] o.s.security.web.FilterChainProxy : /users at position 5 of 11 in additional filter chain; firing Filter: 'OAuth2AuthenticationProcessingFilter'
2018-06-07 05:09:54.311 DEBUG [auth-service,6ad148d1ce54b72f,d9b82e389487d782,true] 1 --- [nio-5000-exec-9] p.a.OAuth2AuthenticationProcessingFilter : Authentication request failed: error="invalid_token", error_description="Cannot convert access token to JSON"
2018-06-07 05:09:54.311 DEBUG [auth-service,6ad148d1ce54b72f,d9b82e389487d782,true] 1 --- [nio-5000-exec-9] o.s.b.a.audit.listener.AuditListener : AuditEvent [timestamp=2018-06-07T05:09:54.311Z, principal=access-token, type=AUTHENTICATION_FAILURE, data={type=org.springframework.security.authentication.BadCredentialsException, message=Cannot convert access token to JSON}]
2018-06-07 05:09:54.312 DEBUG [auth-service,6ad148d1ce54b72f,d9b82e389487d782,true] 1 --- [nio-5000-exec-9] o.s.s.w.header.writers.HstsHeaderWriter : Not injecting HSTS header since it did not match the requestMatcher org.springframework.security.web.header.writers.HstsHeaderWriter$SecureRequestMatcher@33bc882d
2018-06-07 05:09:54.313 DEBUG [auth-service,6ad148d1ce54b72f,d9b82e389487d782,true] 1 --- [nio-5000-exec-9] s.s.o.p.e.DefaultOAuth2ExceptionRenderer : Written [error="invalid_token", error_description="Cannot convert access token to JSON"] as "application/json;charset=UTF-8" using [org.springframework.http.converter.json.MappingJackson2HttpMessageConverter@36c44538]
2018-06-07 05:09:54.313 DEBUG [auth-service,6ad148d1ce54b72f,d9b82e389487d782,true] 1 --- [nio-5000-exec-9] s.s.w.c.SecurityContextPersistenceFilter : SecurityContextHolder now cleared, as request processing completed
2018-06-07 05:09:54.314 DEBUG [auth-service,6ad148d1ce54b72f,d9b82e389487d782,true] 1 --- [nio-5000-exec-9] o.s.b.w.s.f.OrderedRequestContextFilter : Cleared thread-bound request context: org.apache.catalina.connector.RequestFacade@7c2a44b7
2018-06-07 05:09:54.314 DEBUG [auth-service,,,] 1 --- [nio-5000-exec-9] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@aa2cd0:org.apache.tomcat.util.net.NioChannel@26cc8460:java.nio.channels.SocketChannel[connected local=/10.42.217.26:5000 remote=/10.42.15.216:58274]], Read from buffer: [0]
2018-06-07 05:09:54.315 DEBUG [auth-service,,,] 1 --- [nio-5000-exec-9] org.apache.tomcat.util.net.NioEndpoint : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@aa2cd0:org.apache.tomcat.util.net.NioChannel@26cc8460:java.nio.channels.SocketChannel[connected local=/10.42.217.26:5000 remote=/10.42.15.216:58274]], Read direct from socket: [0]
2018-06-07 05:09:54.315 DEBUG [auth-service,,,] 1 --- [nio-5000-exec-9] o.apache.coyote.http11.Http11Processor : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@aa2cd0:org.apache.tomcat.util.net.NioChannel@26cc8460:java.nio.channels.SocketChannel[connected local=/10.42.217.26:5000 remote=/10.42.15.216:58274]], Status in: [OPEN_READ], State out: [OPEN]
2018-06-07 05:09:54.319 DEBUG [auth-service,,,] 1 --- [nio-5000-exec-2] o.a.tomcat.util.net.SocketWrapperBase : Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@aa2cd0:org.apache.tomcat.util.net.NioChannel@26cc8460:java.nio.channels.SocketChannel[connected local=/10.42.217.26:5000 remote=/10.42.15.216:58274]], Read from buffer: [0]
2018-06-07 05:09:54.320 DEBUG [auth-service,,,] 1 --- [nio-5000-exec-2] o.apache.coyote.http11.Http11Processor : Error parsing HTTP request header
java.io.EOFException: null
fixed by
@Override
public void configure(AuthorizationServerEndpointsConfigurer endpoints) {
endpoints
.tokenStore(tokenStore())
.accessTokenConverter(accessTokenConverter())
.authenticationManager(authenticationManager)
.userDetailsService(userDetailsService);
}
Most helpful comment
fixed by