"hierarchy of the type is inconsistent" from Eclipse trying to extend JacksonJsonProvider

1,531 views
Skip to first unread message

t...@quarendon.net

unread,
Aug 15, 2016, 11:22:43 AM8/15/16
to jackson-user
I'm trying to subclass JacksonJsonProvider, but I'm getting "The hierarchy of the type MyJacksonJsonProvider is inconsistent" out of eclipse. This normally means (I think) that something is missing from my classpath, but I can't figure out what.

I have a simple maven eclipse project. I have added a dependency on jackson-jaxrs-json-provider, 2.8.1. I have a simple class:

    import com.fasterxml.jackson.jaxrs.json.JacksonJsonProvider;

    public class MyJacksonJsonProvider extends JacksonJsonProvider {

    }


However, I get this error. 
Naively, I assumed that maven would ensure that all the required dependencies were in place in my classpath?
It has added:
    jaxrs-json-provider
    jaxrs-base
    core
    databind
    annotations
    module-jaxb-annotations
all at version 2.8.1

Any suggestions on what extra I might need in my classpath, or indeed what else the issue is?

Thanks.



t...@quarendon.net

unread,
Aug 15, 2016, 11:28:39 AM8/15/16
to jackson-user
Ah. Accidentally solved my own problem.
javax.ws.rs-api
was missing.

Feels like a missing maven dependency at some level?

Tatu Saloranta

unread,
Aug 16, 2016, 6:28:17 PM8/16/16
to jackso...@googlegroups.com
That is bit tricky... not sure if this is is Eclipse's fault or not. Root cause is due to dependency inclusion being:

    <dependency>
      <groupId>javax.ws.rs</groupId>
      <!-- 05-Apr-2014, tatu: JAX-RS 2.x has different artifact-id, "javax.ws.rs-api"
        -->
      <artifactId>javax.ws.rs-api</artifactId>
      <version>2.0.1</version>
      <scope>provided</scope>
    </dependency>

in pom.xml. This should be sufficient for compilation and I haven't had any isses with Eclipse.
When building a running system, JAX-RS container should provide these classes. Using different scoping could potentially lead to duplication of API jars which may or may not be harmful.
Why this is not the case with Eclipse in your case I don't know.

-+ Tatu +-



--
You received this message because you are subscribed to the Google Groups "jackson-user" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jackson-user+unsubscribe@googlegroups.com.
To post to this group, send email to jackso...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply all
Reply to author
Forward
0 new messages