NoSuchMethodError: MultivaluedMap.addAll in Jersey Client

This looks like an inconsistency pertaining to the JAX-RS API version (which contains the MultiValuedMap).

You are using client jersey-client v2.2, which is compiled against v2.0 of the JAX-RS API. But your runtime states to run with Java EE 6, which defines JAX-RS API v1.1. So your code expects v2.0 of the JAX-RS API, but gets v1.1 at runtime.

This is the MultiValuedMap API for Java EE 6:

http://docs.oracle.com/javaee/6/api/javax/ws/rs/core/MultivaluedMap.html (no addAll method).

And for Java EE 7:

http://docs.oracle.com/javaee/7/api/javax/ws/rs/core/MultivaluedMap.html (this one includes the addAll method).

As you are using Java EE 6, you should be using jersey-client v1.8, not 2.2. Or you should be including the Java EE 7 API in your runtime classpath, and not 6.

Leave a Comment