Failed to use a business model data in a throw/catch event

1
0
-1

Hi,
I fail to add a Business data variable as an item of a thrown message event.
If I use only String values, it's OK but the process fails when the content item is a business variable or a list.
I created 2 entities (BDM) :
- Entity property with 2 String properties (label and value) : Hashmap <String, String>
- Entity with some String properties and a multiple (List) of Entity properties
I did it the same way as shown in the "Expense report" tutorial (expense report and report lines)
When I use only String properties, the message is thrown and caught correctly. But if I use the Entity as content item or only the List it fails.

I am doing someting wrong ? How to throw complex values in a message ? It is about serialization ?

I've been migrating some processes from 5.9 to 7.0.2 and the old processes used java.util.Properties as message content item and it worked fine...

Some logs :
- Business data :

INFOS: [EntryMessage: [correlationId: correlation id, messageType: new job, messageContent: message content, replyTo: reply to, properties: [propertyKey: key1, propertyValue: value1][propertyKey: key2, propertyValue: value2][propertyKey: key3, propertyValue: value3]]]
  • Error :

    GRAVE: THREAD_ID=140 | HOSTNAME=XGS5817 | TENANT_ID=1 | com.thoughtworks.xstream.converters.ConversionException : "Could not call org.apache.tomcat.dbcp.pool.impl.CursorableLinkedList.writeObject() : : Invalid null character in text to output
    ---- Debugging information ----
    message : Could not call org.apache.tomcat.dbcp.pool.impl.CursorableLinkedList.writeObject()
    cause-exception : com.thoughtworks.xstream.io.StreamException
    cause-message : : Invalid null character in text to output
    -------------------------------"
    com.thoughtworks.xstream.converters.ConversionException: Could not call org.apache.tomcat.dbcp.pool.impl.CursorableLinkedList.writeObject() : : Invalid null character in text to output
    ---- Debugging information ----
    message : Could not call org.apache.tomcat.dbcp.pool.impl.CursorableLinkedList.writeObject()
    cause-exception : com.thoughtworks.xstream.io.StreamException

    cause-message : : Invalid null character in text to output

    ...
    Caused by: java.io.IOException: Invalid null character in text to output
    at com.ctc.wstx.api.InvalidCharHandler$FailingHandler.convertInvalidChar(InvalidCharHandler.java:51)
    at com.ctc.wstx.sw.XmlWriter.handleInvalidChar(XmlWriter.java:629)
    at com.ctc.wstx.sw.BufferingXmlWriter.writeCharacters(BufferingXmlWriter.java:586)
    at com.ctc.wstx.sw.BaseStreamWriter.writeCharacters(BaseStreamWriter.java:460)
    ... 215 more

Thank you for your feedback
Remi

Comments

Submitted by yannick.lombardi on Fri, 09/04/2015 - 08:53

Hi.
I think you have invalid characters in the string that is generated from your business object.
You can try this solution to remove this characters :
http://stackoverflow.com/questions/9710185/how-to-deal-with-invalid-char...

If you need more help, post the code that you use. It will be better to see what causes the error.

Submitted by rby on Fri, 09/04/2015 - 13:29

Thank you Yannick for your feedback.

I don't know how to use the stackoverflow solution as the Exception is generated by a bonita class. The data doesn't contain any invalid character, maybe be it's in the bonita implementation...

Maybe the problem is in the mapping expression of the catch message, I'm a bonita 7 newbie ;-), I did it that way :
- throw message : content item = "msgMyObject", value = my variable Object
- catch message : myObject "Takes the value of" msgMyObject
It works fine with standard classes (String, Long, ...), but, in my case, not for Objects (List, Map, ...), maybe there is a stricky syntax...

I found a workaround, as my Object is persisted in the database, I put in the message content only the object persistent id and, in the catching process, get the id to retrieve the Object.

But with this method, I get a Studio error claiming the throw and catch types are incompatible... Maybe because the throw message and the catch message are in different diagrams... But at runtime, no error.

Regards,
Remi

2 answers

1
0
-1

This question is quite old, but some may still stumble upon it.

I believe this is a case of trying to use an hibernate-specific implementation of a business object, instead of its plain java representation (a problem mentioned at the very bottom of this documentation page).

When faced with this error, I replaced my direct call to the Business variable with a fetch from the database (something like myBusinessObjectDao.findByPersistenceId(myBusinessObject.persistenceId), instead of simply myBusinessObject). This can be used directly as the message content through the script editor.

That modification solves the error, and the object received by the message recipient is correctly attached to the business object.

1
0
-1

I am experiencing the same error as reported by rby.

So far, as an alternative workaround, I create a Java variable (e.g. I used a Java HashMap) to represent my business variable and send such a variable in the content of the message. This approach works but require extra steps before and after receiving the message to process the variable accordingly.

Since the original question was posted more than 2 years ago, I was wondering wether this issue has been meanwhile resolved.

Thanks in advance.
Best

Comments

Submitted by vitiellom on Mon, 11/13/2017 - 14:52

As an update, I also tried to follow the suggestion of yannick.lombardi. In a separte task I defined a script to parse every string input of my business data variable properly. However, I still bump into the same exception when the message has to be sent.
Is it really that problematic to send a business data variable between two processes in the content of a message?

Best

Notifications