Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Getting error while using jira rest java client

Qualcomm Support July 27, 2013

When I am using the jira rest java client in one of my plugins, getting below error. Please check below and help.

Caused by: java.lang.NoClassDefFoundError: org/apache/http/pool/ConnPoolControl

at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)

at java.lang.ClassLoader.defineClass(ClassLoader.java:615)

at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.findClass(ModuleImpl.java:1829)

at org.apache.felix.framework.ModuleImpl.findClassOrResourceByDelegation(ModuleImpl.java:716)

at org.apache.felix.framework.ModuleImpl.access$200(ModuleImpl.java:73)

at org.apache.felix.framework.ModuleImpl$ModuleClassLoader.loadClass(ModuleImpl.java:1690)

at java.lang.ClassLoader.loadClass(ClassLoader.java:247)

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.atlassian.jira.plugins.importer.imports.jira.JiraImporterController.<init>(JiraImporterController.java:35) <+3> (NativeConstructorAccessorImpl.java:39) (DelegatingConstructorAccessorImpl.java:27)

at java.lang.reflect.Constructor.newInstance(Constructor.java:513)

at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:100)

... 262 more

3 answers

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

1 vote
Boris Georgiev _Appfire_
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 15, 2013

I had simular problem and sloved it by switching to version 2.0.0-m10 of jira-rest-java-client-core. I also needed to add an exclusion for org.apache.httpcomponents:httpclient for some other dependencies. Run atlas-mvn dependency:tree -Dincludes=org.apache.httpcomponents:httpclient -Dverbose and see which are the offending dependencies. Then put

&lt;exclusions&gt;
    &lt;exclusion&gt;	
        &lt;groupId&gt;org.apache.httpcomponents&lt;/groupId&gt;
        &lt;artifactId&gt;httpclient&lt;/artifactId&gt;
    &lt;/exclusion&gt;
&lt;/exclusions&gt;

to all dependencies that bring version of http client different than the one used by the rest client - 4.2.1

0 votes
Qualcomm Support July 28, 2013

Hi, Thanks for your response.

I am using below jira rest java client version in "Jira Importer Plugin version - 4.4.1" to create another customized importer. In that I want to use jira rest java client api. So I added below entries to pom.xml

Note: JIM version 4.4.1

<dependency>

<groupId>com.atlassian.jira</groupId>

<artifactId>jira-rest-java-client-api</artifactId>

<version>2.0.0-m19</version>

</dependency>

<dependency>

<groupId>com.atlassian.jira</groupId>

<artifactId>jira-rest-java-client-core</artifactId>

<version>2.0.0-m19</version>

</dependency>

So then I just created a sample java class having main in one of the package to test it is working or not.

final AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();

final JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, "test","test");

So when the code reaches to factory.createWithBasicHttpAuthentication, it is throwing the error message I mentioned in my first question

So it seems there is a conflict between the packages available in these both. Not sure which package is creating conflicts. Also when I added above entry in pom.xml, in some of the existing source file, getting below error.

import org.joda.time.Period;

Class Name --> PeriodDeserializer

Period.parse(str); --> The method parse is undefined for the type Perioid

Similar jora package related errors found in some classes

Here also there might be some conflict between the packages.

Regards,

Srinivas Devuke

0 votes
Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 27, 2013

Do an atlas-clean and run it again.

Qualcomm Support July 28, 2013

Hi, Thanks for your response.

I am using below jira rest java client version in "Jira Importer Plugin version - 4.4.1" to create another customized importer. In that I want to use jira rest java client api. So I added below entries to pom.xml

Note: JIM version 4.4.1

<dependency>

<groupId>com.atlassian.jira</groupId>

<artifactId>jira-rest-java-client-api</artifactId>

<version>2.0.0-m19</version>

</dependency>

<dependency>

<groupId>com.atlassian.jira</groupId>

<artifactId>jira-rest-java-client-core</artifactId>

<version>2.0.0-m19</version>

</dependency>

So then I just created a sample java class having main in one of the package to test it is working or not.

final AsynchronousJiraRestClientFactory factory = new AsynchronousJiraRestClientFactory();

final JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, "test","test");

So when the code reaches to factory.createWithBasicHttpAuthentication, it is throwing the error message I mentioned in my first question

So it seems there is a conflict between the packages available in these both. Not sure which package is creating conflicts. Also when I added above entry in pom.xml, in some of the existing source file, getting below error.

import org.joda.time.Period;

Class Name --> PeriodDeserializer

Period.parse(str); --> The method parse is undefined for the type Perioid

Similar jora package related errors found in some classes

Here also there might be some conflict between the packages.

Regards,

Srinivas Devuke

Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2013

If you feel that it is a dependency conflict, use mvn dependency:tree to figure out which is the dependency that you should exclude (http://maven.apache.org/guides/introduction/introduction-to-optional-and-excludes-dependencies.html).

Qualcomm Support July 28, 2013

Hi,

Thanks again for response. I have excluded joda package and joda error is gone.

After updating the httpcomponent versions to below, earlier mentioned errors gone but new error is coming.
This is little urgent to me, your help would be greatly appreciated.

<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<!-- <version>4.1.1</version> -->
<version>4.2.4</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<!-- <version>4.1</version> -->
<version>4.2.4</version>
</dependency>

New Error message:

log4j:WARN No appenders could be found for logger (com.atlassian.jira.rest.client.internal.async.AsynchronousHttpClientFactory$MavenUtils).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
Exception in thread "main" java.lang.RuntimeException: java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
at javax.ws.rs.ext.RuntimeDelegate.getInstance(RuntimeDelegate.java:112)
at javax.ws.rs.core.UriBuilder.newInstance(UriBuilder.java:69)
at javax.ws.rs.core.UriBuilder.fromUri(UriBuilder.java:80)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClient.<init>(AsynchronousJiraRestClient.java:43)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.create(AsynchronousJiraRestClientFactory.java:37)
at com.atlassian.jira.rest.client.internal.async.AsynchronousJiraRestClientFactory.createWithBasicHttpAuthentication(AsynchronousJiraRestClientFactory.java:42)
at com.qualcomm.ems.alm.jira.plugin.importer.action.TestRestClient.main(TestRestClient.java:100)
Caused by: java.lang.ClassNotFoundException: com.sun.ws.rs.ext.RuntimeDelegateImpl
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
Regards,

Srinivas Devuke

Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2013

You will need to make sure that com.sun.ws.rs.ext.RuntimeDelegateImpl is loaded as dependency.

Qualcomm Support July 28, 2013

Hi,

Thanks a lot for ur inputs

I want to share my pom.xml but here i am unable to load the pom.xml as it is restrcting to 2000 characters only.

Is there any way that I can share my pom.xml and so that you can take a look and help me in resolving this issue.

Regards,

Srinivas

Timothy
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
July 28, 2013

Pastbin should help.

keithrbennett July 25, 2014

Pastebin is good, there's also gists on Github (https://gist.github.com/assuming you have a Github account). It's generally better to put any significant amount of code there anyway, so there are no problems with line wrapping, it's displayed in a fixed width font, and so that you can likely get the benefit of color syntax highlighting.

Comments for this post are closed

Community moderators have prevented the ability to post new answers.

Post a new question

TAGS
AUG Leaders

Atlassian Community Events