Search code examples
javajacksonmulejackson2

Mule 3.7.3 and Jackson 2.9.0 issues-NoSuchMethodError


I am having lots of issues getting Mule to work with Jackson classes. The classes present in my final library only have the following files. To eliminate the possibility of maven pulling in other jackson libraries, I create a mule project without using maven and simply pull in the bare minimum libraries. However, it is failing with NoSuchMethodError for CSVMapper().reader(MyClass) etc. and later with

Caused by: java.lang.NoSuchMethodError: 
               com.fasterxml.jackson.databind.JsonMappingException.<init>
         (Ljava/io/Closeable;Ljava/lang/String;)V

jackson-core-2.9.0.jar jackson-databind-2.9.0.jar jackson-annotations-2.9.0.jar jackson-dataformat-csv-2.9.0.jar

I get NoSuchMethodError when I call methods that are definitely in the classpath. To make matters worse the program runs fine outside of Mule.

It turns out that the following module mule-core.3.7.3 has an older version of Jackson i.e. 2.4.3. Unfortunately what works with version 2.9.0 now fails with

 Too many entries: expected at most 1 (value #1 (18 chars) "20170822211046.581")

How can solve this problem?


Solution

  • I solved it by using the Jackson libraries provided by Mule i.e. version 2.4.3 for converted JSON to Java objects. For the CSV conversion to Map I used apache commons-csv replacing Jackson's CSVMapper.