Support Article
NumberFormatException occurs when using REST Connect with OAuth
SA-85890
Summary
NumberFormatException occurs when using REST Connect with OAuth autnetication.
Error Messages
Connect-REST configured with OAuth 2.0 is throwing a NumberFormatException trying to decrypt access token.
com.pega.pegarules.pub.services.OutboundMappingException: Caught Exception while creating OAuth2 client
at com.pega.pegarules.integration.engine.internal.connect.rest.ComponentsOAuth20HttpAuthScheme.setCredentials(ComponentsOAuth20HttpAuthScheme.java:125) ~[printegrint.jar:?] at com.pega.pegarules.integration.engine.internal.connect.rest.ComponentsOAuth20HttpAuthScheme.configure(ComponentsOAuth20HttpAuthScheme.java:298) ~[printegrint.jar:?] at
.
.
.
at com.pega.pegarules.integration.engine.internal.util.OAuth2Utils.getDecrytedAccessToken(OAuth2Utils.java:321) ~[printegrint.jar:?] at com.pega.pegarules.integration.engine.internal.util.OAuth2Utils.decryptAccessToken(OAuth2Utils.java:111) ~[printegrint.jar:?] at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.getAccessToken(OAuth2ClientImpl.java:294) ~[printegrint.jar:?] at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.updateHttpRequestWithAccessToken(OAuth2ClientImpl.java:1072) ~[printegrint.jar:?] at com.pega.pegarules.integration.engine.internal.client.oauth2.OAuth2ClientImpl.updateHttpRequestWithAccessToken(OAuth2ClientImpl.java:1087) ~[printegrint.jar:?] at com.pega.pegarules.integration.engine.internal.connect.rest.ComponentsOAuth20HttpAuthScheme.fetchAccessToken(ComponentsOAuth20HttpAuthScheme.java:101) ~[printegrint.jar:?]
Steps to Reproduce
Create a REST Connect rule and test the connectivity.
Root Cause
The token size exceeded the 4000 database column size where the pr_data_token.pyaccesstoken is stored. The size of the the access token is 4001.
Resolution
Perform the following local-change:
- Increase the column size to 6000 in the table pr_data_token for the pyaccesstoken column.
- Restart the server.
Published August 15, 2019 - Updated December 2, 2021
Have a question? Get answers now.
Visit the Collaboration Center to ask questions, engage in discussions, share ideas, and help others.