Reputation: 101
I am using JasperReports 6.3.1 with a Dropwizard 1.0.5 project and it seems to have a conflict with Jackson when desalinizing my JSON response.
I am getting:
Stacktrace:
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:575)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:462)
....
Caused by: org.apache.jasper.JasperException
and
Stacktrace:
at org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:575)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:477)
...
Caused by: org.apache.jasper.el.JspELException
...
Caused by: java.lang.NoSuchMethodError: com.fasterxml.jackson.databind.ObjectReader.getConfig()Lcom/fasterxml/jackson/databind/DeserializationConfig;
I tried excluding jackson-core
from my Maven dependency but it won't do the trick.
As I see, Jasper uses 2.1.4 and Dropwizard uses 2.7.8
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.3.1</version>
<exclusions>
<exclusion>
<artifactId>jackson-core-asl</artifactId>
<groupId>org.codehaus.jackson</groupId>
</exclusion>
</exclusions>
</dependency>
</dependencies>
Upvotes: 2
Views: 2739
Reputation: 101
I solved my problem. The issue was that as I was using a Dropwizard application (v 1.0.5), which was coming with jackson 2.7.8.
JasperReports is also using jackson, but it uses 2.1.4.
When deserializing the JSON objects, it was using JasperReports's library (v 2.1.4) which didn't have all the needed functions.
I solved this by adding the jackson library (core and annotations) in my pom.xml.
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.7.8</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.7.8</version>
</dependency>
Upvotes: 3
Reputation: 663
Objectreader
class is present in jackson-databind binary.
can you try to excluding jackson-databind and not jackson-core-asl.
<dependency>
<groupId>net.sf.jasperreports</groupId>
<artifactId>jasperreports</artifactId>
<version>6.3.1</version>
<exclusions>
<exclusion>
<artifactId>jackson-databind</artifactId>
<groupId>com.fasterxml.jackson.core</groupId>
</exclusion>
</exclusions>
</dependency>
Upvotes: 1