0

The transformation (xml to json) works completely fine during normal run, but when the same flow is being tested using MUnit it fails at dataweave with error message

There are two transformers that are an exact match for input: interface org.mule.api.transport.OutputHandler, output: class java.lang.String.
Transformers are: ObjectToAtomString(class org.mule.transformer.simple.ObjectToString) and ObjectToString(class org.mule.transformer.simple.ObjectToString$$EnhancerByMUNIT$$99111c4f)

I have added the input MIME TYPE in data transformation as well.

I tried to check the tranformation in another demo project to test it using munit and it passed dataweave successfully without any error.

I have data mapper 3.7.3 jar included in the project and pom file.

chrki
  • 6,143
  • 6
  • 35
  • 55
Himanshu
  • 24
  • 1
  • 8
  • Does your object-to-string transformer's have a name attribute? Where are they? Is one in your flow under test and the other in munit? – Chad Gorshing Dec 31 '16 at 13:00
  • There is no object-to-string transformer in the flow or munit. The error comes at Dataweave which is transforming the XML to Json. The error looks like there are 2 transformation but there is no such thing in the flow. Can it be a issue with classpath? – Himanshu Jan 02 '17 at 03:44

1 Answers1

0

We faced similar issue with DataWeave in Mule 3.8.2 version for munit, though normal run was working fine. we resolved it with below workaround: We had Byte Array to String transformer which was throwing this exception. We changed it to Byte Array to Object and in the object we gave class as java.lang.String.

  • In my case, I am not using byte array to Strimg transformation. I am only using dataweave which is throwing the same exception mentioned above. – Himanshu Jan 02 '17 at 03:46
  • can you share your flow xml file to debug the issue. – Gunjan Deshmukh Jan 02 '17 at 05:23
  • I have checked the flow in another demo project and its working fine with MUNIT. So, my guess is the issue with classpath or libraries. – Himanshu Jan 02 '17 at 12:20
  • good, can u share which libraries were missing for the benefit of all? – Gunjan Deshmukh Jan 02 '17 at 13:05
  • The issue is not resolved yet, still looking into it. The same flow works in another project, I only took the subflow and tested it in another project, the munit tests it fine. but my complete project still throwing the same exception. – Himanshu Jan 03 '17 at 09:46
  • Please check if below link helps: https://www.ricston.com/blog/weaveoutputhandler-and-transformers/ – Gunjan Deshmukh Jan 05 '17 at 14:50