I'm facing a weird issue where my Java application sending requests to AWS cognito using a JWT token and below exception is seen :
022-10-03 08:04:18.023 ERROR 1 — [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() for servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is com.amazonaws.services.cognitoidp.model.AWSCognitoIdentityProviderException: The security token included in the request is expired (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: ExpiredTokenException; Request ID: e83f4f85-a297-4086-b1e4-27be20ef08fc; Proxy: null)] with root cause
com.amazonaws.services.cognitoidp.model.AWSCognitoIdentityProviderException: The security token included in the request is expired (Service: AWSCognitoIdentityProvider; Status Code: 400; Error Code: ExpiredTokenException; Request ID: e83f4f85-a297-4086-b1e4-27be20ef08fc; Proxy: null)
This happens even if I create a new token (valid for an hour). I noticed that the below warning was appearing in my application logs just before these errors :
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by com.fasterxml.jackson.databind.util.ClassUtil (jar:file:/kms/stacs-bb-signer-0.0.1.jar!/BOOT-INF/lib/jackson-databind-2.13.1.jar!/) to field java.lang.Throwable.cause
WARNING: Please consider reporting this to the maintainers of com.fasterxml.jackson.databind.util.ClassUtil
WARNING: Use —illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
I have a strong suspicion that this warning causes my application to throw the above mentioned exception.
Any idea what could be the issue ? I've looked at similar posts where others have faced but can't find a solution (Warning on Illegal reflective access by com.fasterxml.jackson.databind.util.ClassUtil) . My Spring boot version is 2.6 and Java 11 (Amazon Coretto if it matters).