This article describes the dispatcher exception encountered in services after upgrading JM to version 22.10.1. It provides resolution steps to fix the Gson reflection access issue caused by the Dispatcher component.
Applicable To
- Product/Service: Journey Manager (JM)
- Module/Component: Dispatcher
- Versions: JM 22.10.1 and related Dispatcher component
Prerequisites
- Access to the project's pom-imports.xml file.
- Permissions to modify and deploy services.
- Familiarity with updating Dispatcher dependencies.
Problem
After upgrading Journey Manager (JM) to version 22.10.1, services using the Dispatcher component throw the following exception:
Error:
com.google.gson.JsonIOException: Failed making field 'java.nio.charset.Charset#name' accessible; either change its visibility or write a custom TypeAdapter for its declaring type.
Recreation Steps
- Upgrade JM to version 22.10.1.
- Run or invoke services that use the Dispatcher component.
- Observe that a JsonIOException error occurs during execution.
Resolution
Step 1 Update the Dispatcher to a version that resolves the Gson reflection access issue.
- In the pom-imports.xml file, update the Dispatcher dependency to:
<taf-dispatcher-version>2.2.0-RC1</taf-dispatcher-version> - This update replaces the problematic Gson deserialization logic in the source code.
// Old code
return (BaseResponse)new Gson().fromJson(new String(response.textContent), this.class);
// New code
return (BaseResponse)new ObjectMapper().readValue(new String(response.textContent), this.class);
Step 2 Rebuild and redeploy the updated service.
Step 3 Test to confirm the issue is resolved.