0

When deploying my webservice in tomcat 8, I noticed that @JsonIgnore annotations are not being considered.

I tried to upgrade the jackson dependency, but It's still not working.

    <dependency>
        <groupId>org.apache.openejb</groupId>
        <artifactId>apache-tomee</artifactId>
        <version>1.7.3</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.core</groupId>
        <artifactId>jackson-databind</artifactId>
        <version>2.8.11</version>
    </dependency>
Naman
  • 27,789
  • 26
  • 218
  • 353
Giles
  • 1
  • Could you show a package used in class for `JsonIgnore` annotation? – Michał Ziober May 30 '19 at 09:10
  • its com.fasterxml.jackson.annotation.JsonIgnore; – Giles May 30 '19 at 09:19
  • Do you have a control on `ObjectMapper`? How do you serialise your objects? – Michał Ziober May 30 '19 at 09:35
  • no, its just a return from an EJB class that calls a DAO class – Giles May 30 '19 at 09:52
  • Try to check `org.codehaus.jackson` packages/jars on classpath. Maybe it is used. In that case you need to exclude them. Take a look on [org.codehaus.jackson versus com.fasterxml.jackson.core](https://stackoverflow.com/questions/30782706/org-codehaus-jackson-versus-com-fasterxml-jackson-core). Take a look on similar problem on other web server: [Spring boot : org.codehaus.jackson.map.exc.UnrecognizedPropertyException: Unrecognized field “XX” in WebSphere](https://stackoverflow.com/questions/54668902/spring-boot-org-codehaus-jackson-map-exc-unrecognizedpropertyexception-unreco) – Michał Ziober May 30 '19 at 10:02
  • I already tried but it's a lot outdated and still doesn't working. – Giles May 30 '19 at 10:19

1 Answers1

0

Use

<dependency>
    <groupId>org.codehaus.jackson</groupId>
    <artifactId>jackson-core-asl</artifactId>
    <version>1.9.13</version>
</dependency>

com.fasterxml.jackson.core not working tomcat 8