citrusframework / citrusframework/citrus

Send Map Object using JMS Citrus

Open
#1,205 4 comments 0 reactions 0 assignees View on GitHub
bug prio-medium question to-discuss
Dominant language
Java
Stars
485
Forks
155
Avg merge
4d 22h
Merged PRs (30d)
6

Description

**Citrus Version**
4.1.0

**Question**
I am trying to test integration of components and on the other end, i receive this error:
`org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object with class 'java.lang.String' to class 'java.util.Map'
`
**What I've tried so far**
I ve tried adding the following parameters when sending the message:
- `.body(marshal(payload,objectMapper))`
- `.header("_type", Map.class))`
- `.type(MessageType.JSON)`
- and also tried the bellow using `MessagePayloadBuilder`, where i got error `Caused by: jakarta.jms.MessageFormatException: Only objectified primitive objects and String types are allowed... type: class java.util.ArrayList`

```
.body(new MessagePayloadBuilder() {
@Override
public Object buildPayload(TestContext testContext) {
return payloadMap;
}
})
```
**Additional Info**
They payload is a Map with nested ArrayLists

Contributor guide

Open the contributing guide

Research direction

No source files or tests are named. Start by reproducing the JMS send with the nested Map and ArrayLists on Citrus 4.1.0, then trace the payload handling around MessagePayloadBuilder and the JMS message conversion. Done means a nested Map can be sent without the Groovy cast or JMS MessageFormatException.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
distributed-systems
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.