Your guess is right, that there are two incompatible versions of Jersey (or really, JAX-RS) in your runtime. Spark doesn't use Jersey, but its transitive dependencies may, or your transitive dependencies may.
I don't see Jersey in Spark's dependency tree except from HBase tests, which in turn only appear in examples, so that's unlikely to be it. I'd take a look with 'mvn dependency:tree' on your own code first. Maybe you are including JavaEE 6 for example? On Wed, Dec 24, 2014 at 12:02 PM, Emre Sevinc <emre.sev...@gmail.com> wrote: > Hello, > > I have a piece of code that runs inside Spark Streaming and tries to get > some data from a RESTful web service (that runs locally on my machine). The > code snippet in question is: > > Client client = ClientBuilder.newClient(); > WebTarget target = client.target("http://localhost:2222/rest"); > target = target.path("annotate") > .queryParam("text", > UrlEscapers.urlFragmentEscaper().escape(spotlightSubmission)) > .queryParam("confidence", "0.3"); > > logger.warn("!!! DEBUG !!! target: {}", target.getUri().toString()); > > String response = > target.request().accept(MediaType.APPLICATION_JSON_TYPE).get(String.class); > > logger.warn("!!! DEBUG !!! Spotlight response: {}", response); > > When run inside a unit test as follows: > > mvn clean test -Dtest=SpotlightTest#testCountWords > > it contacts the RESTful web service and retrieves some data as expected. But > when the same code is run as part of the application that is submitted to > Spark, using spark-submit script I receive the following error: > > java.lang.NoSuchMethodError: > javax.ws.rs.core.MultivaluedMap.addAll(Ljava/lang/Object;[Ljava/lang/Object;)V > > I'm using Spark 1.1.0 and for consuming the web service I'm using Jersey in > my project's pom.xml: > > <dependency> > <groupId>org.glassfish.jersey.containers</groupId> > <artifactId>jersey-container-servlet-core</artifactId> > <version>2.14</version> > </dependency> > > So I suspect that when the application is submitted to Spark, somehow > there's a different JAR in the environment that uses a different version of > Jersey / javax.ws.rs.* > > Does anybody know which version of Jersey / javax.ws.rs.* is used in the > Spark environment, or how to solve this conflict? > > > -- > Emre Sevinç > https://be.linkedin.com/in/emresevinc/ > --------------------------------------------------------------------- To unsubscribe, e-mail: user-unsubscr...@spark.apache.org For additional commands, e-mail: user-h...@spark.apache.org