Turnsole
Turnsole

Reputation: 3472

Jira Rest Java Client: missing ApacheHttpClientConfig from Jersey

I'm following the JRJC tutorial, and the second line here:

final JerseyJiraRestClientFactory factory = new JerseyJiraRestClientFactory();
final JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, username, password);

Throws this:

Exception in thread "main" java.lang.NoClassDefFoundError: com/sun/jersey/client/apache/config/ApacheHttpClientConfig at com.atlassian.jira.rest.client.internal.jersey.JerseyJiraRestClientFactory.create(JerseyJiraRestClientFactory.java:34)
... 
Caused by: java.lang.ClassNotFoundException: com.sun.jersey.client.apache.config.ApacheHttpClientConfig
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)

I'm requiring Jersey like this in my pom:

<dependency>
    <groupId>com.sun.jersey</groupId>
    <artifactId>jersey-client</artifactId>
    <version>1.9</version>
</dependency>

It builds without any issues (mvn assembly:single, since I need a standalone jar). Any ideas what went wrong here?

Upvotes: 1

Views: 3786

Answers (1)

Turnsole
Turnsole

Reputation: 3472

Well, that was silly enough. jersey-client doesn't give you ApacheHttpClientConfig. That comes with jersey-apache-client. Here's the pom snippet.

<dependency>
    <groupId>com.sun.jersey.contribs</groupId>
    <artifactId>jersey-apache-client</artifactId>
    <version>1.9</version>
</dependency>

Upvotes: 3

Related Questions