I’m encountering an issue while configuring custom message builders and formatters in WSO2 Integration Studio (or WSO2 Carbon). I have followed the steps to add a custom message builder (org.wso2.carbon.integrator.core.json.JsonStreamBuilder) and formatter (org.wso2.carbon.integrator.core.json.JsonStreamFormatter) for handling application/problem+json content type in both deployment.toml and axis2.xml.
After making these configurations and restarting the server, I’m facing the following error:
`WSO2 Carbon initialization Failed org.apache.axis2.AxisFault: Exception occurred while loading the Axis configuration from /path/to/axis2.xml
Caused by: org.apache.axis2.deployment.DeploymentException: A ClassNotFoundException error occurred while validating the message builder org.wso2.carbon.integrator.core.json.JsonStreamBuilder
Caused by: java.lang.ClassNotFoundException: org.wso2.carbon.integrator.core.json.JsonStreamBuilder cannot be found by axis2_1.6.1.wso2v85
`
Steps Token:
- Added the following configurations to deployment.toml:
Steps Token:
[[custom_message_formatters]]
class = "org.wso2.carbon.integrator.core.json.JsonStreamFormatter"
content_type = "application/problem+json"
[[custom_message_builders]]
class = "org.wso2.carbon.integrator.core.json.JsonStreamBuilder"
content_type = "application/problem+json"
- Updated axis2.xml to include references to the custom message builder and formatter:
<messageBuilders>
<builder contentType="application/problem+json" class="org.wso2.carbon.integrator.core.json.JsonStreamBuilder"/>
<!-- Other message builders -->
</messageBuilders>
<messageFormatters>
<formatter contentType="application/problem+json" class="org.wso2.carbon.integrator.core.json.JsonStreamFormatter"/>
<!-- Other message formatters -->
</messageFormatters>
Error Details:
- Error Message: WSO2 Carbon initialization Failed org.apache.axis2.AxisFault: Exception occurred while loading the Axis configuration from /path/to/axis2.xml
- Caused by: org.apache.axis2.deployment.DeploymentException: A ClassNotFoundException error occurred while validating the message builder
- org.wso2.carbon.integrator.core.json.JsonStreamBuilder
Caused by: java.lang.ClassNotFoundException: org.wso2.carbon.integrator.core.json.JsonStreamBuilder cannot be found by axis2_1.6.1.wso2v85
Emna Sallemi is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
Your class names are wrong. Try setting the following. The correct builder class is the below. Also don’t change the axis2.xml
add the below to delpoyment.toml
[[custom_message_formatters]]
class = "org.wso2.micro.integrator.core.json.JsonStreamFormatter"
content_type = "application/problem+json"
[[custom_message_builders]]
class = "org.wso2.micro.integrator.core.json.JsonStreamBuilder"
content_type = "application/problem+json"