NoSuchMethodError AuthenticationHandler.configure

Oliver Hoff November 28, 2013

Hi,

I'm using the Jira Rest Java Client Library like described here:
https://ecosystem.atlassian.net/wiki/display/JRJC/Tutorial

Here's the part of my Code, that establishes the connection:

public class JiraConnection {
    
    private URI jiraHost;
    private JiraRestClient restClient;
    private JerseyJiraRestClientFactory factory;
    private NullProgressMonitor pm;
	
	public JiraConnection() throws URISyntaxException{
        pm = new NullProgressMonitor();
        jiraHost =  new URI("http://myJiraHiost/");
        factory = new JerseyJiraRestClientFactory();
		//This is line 34:
        restClient = factory.createWithBasicHttpAuthentication(jiraHost, "x", "y"); 
    }
	...



When the Constructor of this class is called I recieve the following exception:

java.lang.NoSuchMethodError: com.atlassian.jira.rest.client.AuthenticationHandler.configure(Lcom/sun/jersey/client/apache/config/ApacheHttpClientConfig;)V
    at com.atlassian.jira.rest.client.internal.jersey.JerseyJiraRestClient.<init>(JerseyJiraRestClient.java:63)
    at com.atlassian.jira.rest.client.internal.jersey.JerseyJiraRestClientFactory.create(JerseyJiraRestClientFactory.java:34)
    at com.atlassian.jira.rest.client.internal.jersey.JerseyJiraRestClientFactory.createWithBasicHttpAuthentication(JerseyJiraRestClientFactory.java:39)
    at ...JiraConnection.<init>(JiraConnection.java:34) //this the constructor of my class
    ...



I googled for it an looked at the sourcecode of AuthetificationHandler, JerseyJiraRestClient.java:63 and other involved classes but couldn't detect the root cause.
Do you have any clues?

If you need more information let me know. Thanks for any advice!

Regards

4 answers

1 accepted

1 vote
Answer accepted
Aleksander Mierzwicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 28, 2013

I noticed that jira-rest-java-client(-core/plugin/api) have slightly different versions. Might this be the problem?

Yes, this is problem for sure. You have to depend only on jira-rest-java-client-core and I suggest using the most fresh version (2.0.0-m25).

This is because probably your code uses 2.0.0-m2 API which is aparently sligly different than 2.0.0-m25. If the problem still exists after fixing dependencies then please verify what JARs do you have on classpath inside glassfish container. And compare that with output of mvn dependency:list.

Also the jira-rest-java-client dependency should be the only one that you need for that project - all the jersey, apache client etc should be pulled from maven automatically with proper versions (unless you use other dependency that depends on other version of those libraries - but then you'll have fun anyway if the're not compatibile ;)).

Oliver Hoff November 28, 2013

Thank you, that solved the problem!

I removed the other dependencies and now only have jira-rest-java-client-core 2.0.0-m25 left.

0 votes
Oliver Hoff November 28, 2013
<dependency>
            <artifactId>hsqldb</artifactId>
            <groupId>hsqldb</groupId>
            <type>jar</type>
            <version>1.8.0.10</version>
        </dependency>
        <dependency>
            <artifactId>com.darwinsys</artifactId>
            <groupId>util</groupId>
            <type>jar</type>
            <version>1.0.0</version>
        </dependency>
        <dependency>
            <artifactId>slf4j-log4j12</artifactId>
            <groupId>org.slf4j</groupId>
            <type>jar</type>
            <version>1.5.6</version>
        </dependency>
        <dependency>
            <artifactId>jersey-client</artifactId>
            <groupId>com.sun.jersey</groupId>
            <type>jar</type>
            <version>1.6</version>
        </dependency>
        <dependency>
            <artifactId>jersey-core</artifactId>
            <groupId>com.sun.jersey</groupId>
            <type>jar</type>
            <version>1.6</version>
        </dependency>
        <dependency>
            <artifactId>jersey-json</artifactId>
            <groupId>com.sun.jersey</groupId>
            <type>jar</type>
            <version>1.6</version>
        </dependency>
        <dependency>
            <artifactId>jersey-apache-client</artifactId>
            <groupId>com.sun.jersey.contribs</groupId>
            <type>jar</type>
            <version>1.6</version>
        </dependency>
    </dependencies>

0 votes
Oliver Hoff November 28, 2013

Here is the pom.xml. I run the project in NetBeans on a Glassfish server.

I'm using JRJC 2.0.0

I noticed that jira-rest-java-client(-core/plugin/api) have slightly different versions. Might this be the problem?

<dependencies>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-java-client-api</artifactId>
            <version>2.0.0-m25</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-java-client-core</artifactId>
            <version>2.0.0-m25</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-java-client</artifactId>
            <version>2.0.0-m2</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-java-client-plugin</artifactId>
            <version>2.0.0-m23</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>com.atlassian.jira</groupId>
            <artifactId>jira-rest-java-client-p3</artifactId>
            <version>0.6-m6-db4</version>
            <scope>compile</scope>
        </dependency>
        <dependency>
            <groupId>displaytag</groupId>
            <artifactId>displaytag</artifactId>
            <version>1.2</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>com.springsource.org.apache.poi</artifactId>
            <version>3.9.0.FINAL</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.ws</groupId>
            <artifactId>jaxws-rt</artifactId>
            <version>2.2.8</version>
        </dependency>
        <dependency>
            <groupId>javax.jws</groupId>
            <artifactId>jsr181-api</artifactId>
            <version>1.0-MR1</version>
        </dependency>

0 votes
Aleksander Mierzwicki
Atlassian Team
Atlassian Team members are employees working across the company in a wide variety of roles.
November 28, 2013

Could you share pom.xml? What version of JRJC do you use? How do you run your project?

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events