JRJC is throwing NoClassDefFound exceptions

人走茶凉 提交于 2019-12-24 05:46:10

问题


I am trying to use Jira Rest Java Client in my project. But not able to connect to my installed jira. While using the below code snippet:

JiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();
 JiraRestClient restClient =factory.createWithBasicHttpAuthentication(serverURI, "praveen",
 "Jira@123");

I am facing an error as stated below:

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/nio/NHttpMessageParserFactory
at org.apache.http.impl.nio.conn.PoolingClientAsyncConnectionManager.createClientAsyncConnectionFactory(PoolingClientAsyncConnectionManager.java:96)
at org.apache.http.impl.nio.conn.PoolingClientAsyncConnectionManager.<init>(PoolingClientAsyncConnectionManager.java:72)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient$2.<init>(DefaultHttpClient.java:117)
at com.atlassian.httpclient.apache.httpcomponents.DefaultHttpClient.<init>(DefaultHttpClient.java:115)
at com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory.createClient(AsynchronousHttpClientFactory.java:53)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.create(AsynchronousJiraRestClientFactory.java:35)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.createWithBasicHttpAuthentication(AsynchronousJiraRestClientFactory.java:42)
at com.praveen.jira.JiraPoc.main(JiraPoc.java:77)

I am using JRJC in my pom.xml as dependency with following tag:

<dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-api</artifactId>
        <version>2.0.0-m25</version>
    </dependency>

Is there something I am missing. My client usage class is on the same line as this example by jira :

https://bitbucket.org/atlassian/jrjc-example/src/54673b037ab77997c22950ff00489de1752f0353/src/main/java/com/atlassian/jira/rest/client/example/Main.java?at=master&fileviewer=file-view-default

Please help me with this I am stuck for a long time. If possible please provide with working example. EDIT as per request:

C:\Users\praveen.joshi\git\dashboard\jira-poc>mvn dependency:tree -Dverbose
[INFO] Scanning for projects...
[WARNING]
[WARNING] Some problems were encountered while building the effective model for com.bolt.dashboard:jira-poc:jar:0.0.1-SNAPSHOT
[WARNING] 'parent.relativePath' of POM com.bolt.dashboard:jira-poc:0.0.1-SNAPSHOT (C:\Users\praveen.joshi\git\dashboard\jira-poc\pom.xml) points at com.bolt.dashboard:jenkins-collector instead of org.springframework.boot:spring-boot-starter-parent, please verify your project structure @ line 9, column 10
[WARNING]
[WARNING] It is highly recommended to fix these problems because they threaten the stability of your build.
[WARNING]
[WARNING] For this reason, future Maven versions might no longer support building such malformed projects.
[WARNING] Using Maven 2 dependency tree to get verbose output, which may be inconsistent with actual Maven 3 resolution
[INFO] com.praveen.dashboard:jira-poc:jar:0.0.1-SNAPSHOT
[INFO] +- com.praveen.dashboard:core:jar:0.0.1-SNAPSHOT:compile
[INFO] |  +- org.springframework:spring-test:jar:4.2.5.RELEASE:compile (version managed from 4.1.7.RELEASE)
[INFO] |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  +- org.springframework.data:spring-data-mongodb:jar:1.8.4.RELEASE:compile (version managed from 1.8.0.RELEASE)
[INFO] |  |  +- org.springframework:spring-tx:jar:4.2.5.RELEASE:compile (version managed from 4.1.9.RELEASE)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- org.springframework:spring-expression:jar:4.2.5.RELEASE:compile
[INFO] |  |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- org.springframework.data:spring-data-commons:jar:1.11.4.RELEASE:compile
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  |  +- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.7.13; omitted for duplicate)
[INFO] |  |  |  \- (org.slf4j:jcl-over-slf4j:jar:1.7.16:runtime - version managed from 1.7.13; omitted for duplicate)
[INFO] |  |  +- (org.mongodb:mongo-java-driver:jar:2.13.3:compile - version managed from 2.10.0; omitted for duplicate)
[INFO] |  |  +- org.slf4j:slf4j-api:jar:1.7.16:compile
[INFO] |  |  \- (org.slf4j:jcl-over-slf4j:jar:1.7.16:compile - version managed from 1.7.13; scope updated from runtime; omitted for duplicate)
[INFO] |  +- org.springframework:spring-core:jar:4.2.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-context-support:jar:4.2.5.RELEASE:compile (version managed from 4.1.7.RELEASE)
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  +- org.quartz-scheduler:quartz:jar:2.2.1:compile
[INFO] |  |  +- c3p0:c3p0:jar:0.9.1.1:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.6; omitted for duplicate)
[INFO] |  +- com.mysema.querydsl:querydsl-jpa:jar:3.6.0:compile
[INFO] |  |  +- com.mysema.querydsl:querydsl-core:jar:3.6.0:compile
[INFO] |  |  |  +- (com.google.guava:guava:jar:18.0:compile - omitted for conflict with 10.0.1)
[INFO] |  |  |  +- (com.google.code.findbugs:jsr305:jar:1.3.9:compile - omitted for duplicate)
[INFO] |  |  |  +- com.mysema.commons:mysema-commons-lang:jar:0.2.4:compile
[INFO] |  |  |  \- com.infradna.tool:bridge-method-annotation:jar:1.13:compile
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  +- com.mysema.querydsl:querydsl-apt:jar:3.6.0:compile
[INFO] |  |  \- com.mysema.querydsl:querydsl-codegen:jar:3.6.0:compile
[INFO] |  |     +- (com.mysema.querydsl:querydsl-core:jar:3.6.0:compile - omitted for duplicate)
[INFO] |  |     +- com.mysema.codegen:codegen:jar:0.6.5:compile
[INFO] |  |     |  +- (com.google.guava:guava:jar:18.0:compile - omitted for duplicate)
[INFO] |  |     |  \- org.eclipse.jdt.core.compiler:ecj:jar:4.3.1:compile
[INFO] |  |     \- javax.inject:javax.inject:jar:1:compile
[INFO] |  +- com.mysema.querydsl:querydsl-mongodb:jar:3.6.0:compile
[INFO] |  |  +- (org.mongodb:mongo-java-driver:jar:2.13.3:compile - version managed from 2.10.0; omitted for duplicate)
[INFO] |  |  +- (com.mysema.querydsl:querydsl-core:jar:3.6.0:compile - omitted for duplicate)
[INFO] |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  \- (com.googlecode.json-simple:json-simple:jar:1.1.1:compile - omitted for duplicate)
[INFO] +- org.springframework.boot:spring-boot-starter-data-mongodb:jar:1.3.3.RELEASE:compile
[INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.3.3.RELEASE:compile
[INFO] |  |  +- org.springframework.boot:spring-boot:jar:1.3.3.RELEASE:compile
[INFO] |  |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  |  |  \- (org.springframework:spring-context:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- org.springframework.boot:spring-boot-autoconfigure:jar:1.3.3.RELEASE:compile
[INFO] |  |  |  \- (org.springframework.boot:spring-boot:jar:1.3.3.RELEASE:compile - omitted for duplicate)
[INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.3.3.RELEASE:compile
[INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.5:compile
[INFO] |  |  |  |  +- ch.qos.logback:logback-core:jar:1.1.5:compile
[INFO] |  |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  |  |  +- org.slf4j:jcl-over-slf4j:jar:1.7.16:compile
[INFO] |  |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.16:compile
[INFO] |  |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.16:compile
[INFO] |  |  |     \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.1; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  |  \- org.yaml:snakeyaml:jar:1.16:runtime
[INFO] |  +- org.mongodb:mongo-java-driver:jar:2.13.3:compile
[INFO] |  \- (org.springframework.data:spring-data-mongodb:jar:1.8.4.RELEASE:compile - version managed from 1.8.0.RELEASE; omitted for duplicate)
[INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.3.3.RELEASE:test
[INFO] |  +- (junit:junit:jar:4.12:compile - version managed from 4.10; scope updated from test; omitted for duplicate)
[INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test
[INFO] |  |  +- (org.hamcrest:hamcrest-core:jar:1.3:compile - version managed from 1.1; scope updated from test; omitted for duplicate)
[INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test
[INFO] |  +- (org.hamcrest:hamcrest-core:jar:1.3:compile - version managed from 1.1; scope updated from test; omitted for duplicate)
[INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test
[INFO] |  |  \- (org.hamcrest:hamcrest-core:jar:1.3:compile - version managed from 1.1; scope updated from test; omitted for duplicate)
[INFO] |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:test - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-test:jar:4.2.5.RELEASE:test - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] +- org.springframework:spring-web:jar:4.2.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.2.5.RELEASE:compile
[INFO] |  |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  +- org.springframework:spring-beans:jar:4.2.5.RELEASE:compile
[INFO] |  |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  +- org.springframework:spring-context:jar:4.2.5.RELEASE:compile
[INFO] |  |  +- (org.springframework:spring-aop:jar:4.2.5.RELEASE:compile - omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-beans:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] |  |  \- (org.springframework:spring-expression:jar:4.2.5.RELEASE:compile - version managed from 4.1.9.RELEASE; omitted for duplicate)
[INFO] |  \- (org.springframework:spring-core:jar:4.2.5.RELEASE:compile - version managed from 4.1.7.RELEASE; omitted for duplicate)
[INFO] +- com.googlecode.json-simple:json-simple:jar:1.1.1:compile
[INFO] |  \- junit:junit:jar:4.12:compile (version managed from 4.10)
[INFO] |     \- org.hamcrest:hamcrest-core:jar:1.3:compile (version managed from 1.1)
[INFO] +- org.apache.commons:commons-lang3:jar:3.3.2:compile
[INFO] +- org.apache.httpcomponents:httpclient:jar:4.2.1-atlassian-2:compile
[INFO] |  +- org.apache.httpcomponents:httpcore:jar:4.4.4:compile (version managed from 4.2.1)
[INFO] |  \- commons-codec:commons-codec:jar:1.6:compile
[INFO] +- com.atlassian.jira:jira-rest-java-client-core:jar:3.0.0:compile
[INFO] |  +- (com.atlassian.jira:jira-rest-java-client-api:jar:3.0.0:compile - omitted for conflict with 2.0.0)
[INFO] |  +- com.sun.jersey:jersey-client:jar:1.5:compile
[INFO] |  |  \- com.sun.jersey:jersey-core:jar:1.5:compile
[INFO] |  +- com.sun.jersey:jersey-json:jar:1.5:compile
[INFO] |  |  +- (com.sun.jersey:jersey-core:jar:1.5:compile - omitted for duplicate)
[INFO] |  |  +- org.codehaus.jettison:jettison:jar:1.1:compile
[INFO] |  |  +- com.sun.xml.bind:jaxb-impl:jar:2.2.3:compile
[INFO] |  |  |  \- javax.xml.bind:jaxb-api:jar:2.2.2:compile
[INFO] |  |  |     +- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] |  |  |     \- javax.activation:activation:jar:1.1:compile
[INFO] |  |  +- org.codehaus.jackson:jackson-core-asl:jar:1.5.5:compile
[INFO] |  |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.5.5:compile
[INFO] |  |  |  \- (org.codehaus.jackson:jackson-core-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.5.5:compile
[INFO] |  |  |  +- (org.codehaus.jackson:jackson-core-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  |  |  \- (org.codehaus.jackson:jackson-mapper-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  |  \- org.codehaus.jackson:jackson-xc:jar:1.5.5:compile
[INFO] |  |     +- (org.codehaus.jackson:jackson-core-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  |     \- (org.codehaus.jackson:jackson-mapper-asl:jar:1.5.5:compile - omitted for duplicate)
[INFO] |  +- joda-time:joda-time:jar:2.8.2:compile
[INFO] |  +- com.atlassian.httpclient:atlassian-httpclient-apache-httpcomponents:jar:0.13.2:compile
[INFO] |  |  +- (com.atlassian.httpclient:atlassian-httpclient-api:jar:0.13.2:compile - omitted for duplicate)
[INFO] |  |  +- com.atlassian.sal:sal-api:jar:2.7.0:compile
[INFO] |  |  +- com.atlassian.event:atlassian-event:jar:2.2.0:compile
[INFO] |  |  |  +- (com.atlassian.util.concurrent:atlassian-util-concurrent:jar:0.0.12:compile - omitted for conflict with 2.4.0-M9)
[INFO] |  |  |  +- (com.google.guava:guava:jar:10.0.1:compile - omitted for duplicate)
[INFO] |  |  |  +- (commons-lang:commons-lang:jar:2.4:compile - omitted for conflict with 2.5)
[INFO] |  |  |  \- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.5.8; omitted for duplicate)
[INFO] |  |  +- (org.slf4j:slf4j-api:jar:1.7.16:compile - version managed from 1.6.4; omitted for duplicate)
[INFO] |  |  +- org.apache.httpcomponents:httpasyncclient-cache:jar:4.0-beta3-atlassian-1:compile
[INFO] |  |  |  +- (org.apache.httpcomponents:httpasyncclient:jar:4.0-beta3-atlassian-1:compile - omitted for duplicate)
[INFO] |  |  |  \- (org.apache.httpcomponents:httpclient-cache:jar:4.2.1-atlassian-2:compile - omitted for duplicate)
[INFO] |  |  +- org.apache.httpcomponents:httpclient-cache:jar:4.2.1-atlassian-2:compile
[INFO] |  |  |  +- (org.apache.httpcomponents:httpclient:jar:4.2.1-atlassian-2:compile - omitted for duplicate)
[INFO] |  |  |  \- (commons-logging:commons-logging:jar:1.1.1:compile - omitted for duplicate)
[INFO] |  |  +- org.apache.httpcomponents:httpasyncclient:jar:4.0-beta3-atlassian-1:compile
[INFO] |  |  |  \- (org.apache.httpcomponents:httpclient:jar:4.2.1-atlassian-2:compile - omitted for duplicate)
[INFO] |  |  +- (org.apache.httpcomponents:httpcore:jar:4.4.4:compile - version managed from 4.2.2; omitted for duplicate)
[INFO] |  |  +- org.apache.httpcomponents:httpcore-nio:jar:4.2.2:compile
[INFO] |  |  |  \- (org.apache.httpcomponents:httpcore:jar:4.4.4:compile - version managed from 4.2.2; omitted for duplicate)
[INFO] |  |  +- (org.springframework:spring-context:jar:4.2.5.RELEASE:compile - version managed from 2.5.6; omitted for duplicate)
[INFO] |  |  \- (org.apache.httpcomponents:httpmime:jar:4.2.1-atlassian-2:compile - version managed from 4.1.2; omitted for duplicate)
[INFO] |  +- com.atlassian.util.concurrent:atlassian-util-concurrent:jar:2.4.0-M9:compile
[INFO] |  +- org.apache.httpcomponents:httpmime:jar:4.2.1-atlassian-2:compile
[INFO] |  \- com.google.guava:guava:jar:10.0.1:compile
[INFO] |     \- com.google.code.findbugs:jsr305:jar:1.3.9:compile
[INFO] +- com.atlassian.jira:jira-rest-java-client-api:jar:2.0.0:compile
[INFO] |  +- (com.atlassian.util.concurrent:atlassian-util-concurrent:jar:2.4.0-M9:compile - omitted for duplicate)
[INFO] |  +- com.atlassian.httpclient:atlassian-httpclient-api:jar:0.13.2:compile
[INFO] |  |  +- com.atlassian.httpclient:atlassian-httpclient-spi:jar:0.13.2:compile
[INFO] |  |  +- (com.google.guava:guava:jar:10.0.1:compile - omitted for duplicate)
[INFO] |  |  \- (com.atlassian.util.concurrent:atlassian-util-concurrent:jar:2.4.0:compile - omitted for conflict with 2.4.0-M9)
[INFO] |  +- (joda-time:joda-time:jar:2.8.2:compile - version managed from 1.6; omitted for duplicate)
[INFO] |  \- (com.google.guava:guava:jar:10.0.1:compile - omitted for duplicate)
[INFO] \- net.rcarz:jira-client:jar:0.5:compile
[INFO]    +- (org.apache.httpcomponents:httpclient:jar:4.2.1-atlassian-2:compile - version managed from 4.2.5; omitted for duplicate)
[INFO]    +- (org.apache.httpcomponents:httpmime:jar:4.2.1-atlassian-2:compile - version managed from 4.2.5; omitted for duplicate)
[INFO]    +- net.sf.json-lib:json-lib:jar:jdk15:2.4:compile
[INFO]    |  +- commons-beanutils:commons-beanutils:jar:1.9.2:compile (version managed from 1.8.0)
[INFO]    |  |  \- (commons-collections:commons-collections:jar:3.2.2:compile - version managed from 3.2.1; omitted for duplicate)
[INFO]    |  +- commons-collections:commons-collections:jar:3.2.2:compile
[INFO]    |  +- commons-lang:commons-lang:jar:2.5:compile
[INFO]    |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO]    |  \- net.sf.ezmorph:ezmorph:jar:1.0.6:compile
[INFO]    |     \- (commons-lang:commons-lang:jar:2.3:compile - omitted for conflict with 2.5)
[INFO]    +- (joda-time:joda-time:jar:2.8.2:compile - version managed from 2.3; omitted for duplicate)
[INFO]    +- (junit:junit:jar:4.12:compile - version managed from 4.8.2; omitted for duplicate)
[INFO]    +- org.mockito:mockito-all:jar:1.9.0:compile
[INFO]    \- commons-httpclient:commons-httpclient:jar:3.1:compile
[INFO]       +- (commons-logging:commons-logging:jar:1.0.4:compile - omitted for conflict with 1.1.1)
[INFO]       \- (commons-codec:commons-codec:jar:1.2:compile - omitted for conflict with 1.6)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 03:40 min
[INFO] Finished at: 2016-04-27T16:19:12+05:30
[INFO] Final Memory: 20M/98M
[INFO] ------------------------------------------------------------------------

C:\Users\praveen.joshi\git\dashboard\jira-poc>

回答1:


I see several problem in dependency tree. First. org.apache.httpcomponents:httpcore:jar:4.4.4:compile - version managed from 4.2.2. version managed from means that httpcore should have 4.2.2 version, but somebody changed it. It may be the root of problem. Did you change version of httpcore to 4.4.4? Second. You have added com.atlassian.jira:jira-rest-java-client-api dependency with 2.0.0 version but com.atlassian.jira:jira-rest-java-client-core is used with 3.0.0 version. I think you can remove com.atlassian.jira:jira-rest-java-client-api dependency from pom.xml or upgrade it to 3.0.0. Also notice, that example project which you references use 2.0.0-m25 version of jira-rest-java-client-core and jira-rest-java-client-api.




回答2:


You're missing some dependencies in your pom. Add this:

<dependencies>
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.8.2</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-json</artifactId>
        <version>1.5</version>
    </dependency>
    <dependency>
        <groupId>com.sun.jersey</groupId>
        <artifactId>jersey-client</artifactId>
        <version>1.9</version>
    </dependency>
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-api</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.atlassian.jira</groupId>
        <artifactId>jira-rest-java-client-core</artifactId>
        <version>3.0.0</version>
    </dependency>
    <dependency>
        <groupId>com.google.guava</groupId>
        <artifactId>guava</artifactId>
        <version>14.0-rc1</version>
    </dependency>
    <dependency>
        <groupId>org.codehaus.jettison</groupId>
        <artifactId>jettison</artifactId>
        <version>1.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-simple</artifactId>
        <version>1.6.4</version>
    </dependency>
    <dependency>
        <groupId>commons-io</groupId>
        <artifactId>commons-io</artifactId>
        <version>2.4</version>
    </dependency>
</dependencies>

Then you can call your code like this:

public Issue getIssue(String issueKey) throws Exception
{
    final URI jiraServerUri = new URI("https://jira-domain");
    final JiraRestClient restClient = new AsynchronousJiraRestClientFactory().createWithBasicHttpAuthentication(jiraServerUri, "user@domain.com", "password");
    Promise issuePromise = restClient.getIssueClient().getIssue(issueKey);
    return Optional.ofNullable((Issue) issuePromise.claim()).orElseThrow(() -> new Exception("No such issue"));
}

I assume you have already added the needed repositories and plugin repositories to your maven settings.xml (or you can add them to your pom.xml too):

        <repositories>
           <repository>
                <id>atlassian-public</id>
                <url>https://m2proxy.atlassian.com/repository/public</url>
                <snapshots>
                    <enabled>true</enabled>
                    <updatePolicy>daily</updatePolicy>
                    <checksumPolicy>warn</checksumPolicy>
                </snapshots>
                <releases>
                    <enabled>true</enabled>
                    <checksumPolicy>warn</checksumPolicy>
                </releases>
            </repository>
        </repositories>

    <pluginRepositories>                
            <pluginRepository>
                <id>atlassian-public</id>
                <url>https://m2proxy.atlassian.com/repository/public</url>
                <releases>
                    <enabled>true</enabled>
                    <checksumPolicy>warn</checksumPolicy>
                </releases>
                <snapshots>
                    <checksumPolicy>warn</checksumPolicy>
                </snapshots>
            </pluginRepository>
        </pluginRepositories>

Find the full code here: https://github.com/somaiah/jrjc



来源:https://stackoverflow.com/questions/36864240/jrjc-is-throwing-noclassdeffound-exceptions

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!