You’re using both Jersey 1 & 2 (Jersey 1 is an explicit dependency, Jersey 2 is a transitive dependency of jersey-test-framework-provider-jdk-http) and that’s not possible – so the classloader is picking up the wrong URIBuilder class.

The Jersey dependencies in group com.sun.jersey are all Jersey version 1.
Jersey version 2 uses the group org.glassfish.jersey.

You have both in your Maven dependencies which is causing this problem.

If possible only use Jersey 2.

Leave a Comment