Mule2 and the IllegalArgumentException

This is the first of a series of short posts about issues we had when using Mule2 in a real project. The first issue I want to mention is the IllegalArgumentException. When we first ran into this exception we hadn’t really a clue where to look for the solution. After some investigation it appeared that the exception is raised when a components operation is called with the wrong type of argument.
Most likely this error:

Root Exception stack trace:
java.lang.IllegalArgumentException: argument type mismatch
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(
at sun.reflect.DelegatingMethodAccessorImpl.invoke(
at java.lang.reflect.Method.invoke(
at org.mule.transport.cxf.CxfMessageDispatcher.doSendWithProxy(

will occur if you forget to use a translator or the translator you configured doesn’t work as expected as was the case in our situation. We are receiving an XML file as a JMS message and wanted to translate this XML file to a Java object that we used as argument in our component. For the XML to Java translation we were relying on the default xml-to-object-translator. However we only got it working by using a custom translator that is using Jaxb2 for the translation as I described here.

About Pascal Alma

Pascal is a senior software developer and architect. Pascal has been designing and building applications since 2001. He is particularly interested in Open Source toolstack (Mule, Spring Framework, JBoss) and technologies like Web Services, SOA and Cloud technologies. Lately he is having great fun by building iOS apps with Swift. Specialties: JEE AWS XML/XSD/XSLT Web Services/SOA Mule ESB/ WSO2 ESB Maven Cloud Technology Swift/ iOS
This entry was posted in Mule and tagged , . Bookmark the permalink.