繁体   English   中英

NoClassDefFoundError JIRA REST API

[英]NoClassDefFoundError JIRA REST API

我是JIRA的新手我为eclipse Indigo和JIRA 5.0版本下载了m2e插件

public class JIRAClient { 
       public static void main(String[] args) throws URISyntaxException {  
           final JerseyJiraRestClientFactory factory = new JerseyJiraRestClientFactory();
           final URI jiraServerUri = new URI("http://jira.travelclick.net:8080/jira/rest/api"); 

Exception---> final JiraRestClient restClient = factory.createWithBasicHttpAuthentication(jiraServerUri, "nsrivastava", "Password12");

           final NullProgressMonitor pm = new NullProgressMonitor();    
           final Issue issue = restClient.getIssueClient().getIssue("TST-1", pm);
           System.out.println(issue);          

           } 
       }

我有以下例外

Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpConnectionManager
    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 client.JIRAClient.main(JIRAClient.java:24)

我还下载了commons-logging-1.1.1.jar文件,这里是我的classpath文件(由eclipse创建)

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
    <classpathentry kind="src" output="target/classes" path="src/main/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="src" output="target/test-classes" path="src/test/java">
        <attributes>
            <attribute name="optional" value="true"/>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
        <attributes>
            <attribute name="maven.pomderived" value="true"/>
        </attributes>
    </classpathentry>
    <classpathentry kind="lib" path="C:/Users/bhaviksh/Downloads/httpcomponents-client-4.2.2-bin/httpcomponents-client-4.2.2/lib/commons-logging-1.1.1.jar"/>
    <classpathentry kind="output" path="target/classes"/>
</classpath>

这将是我的第一个程序,我甚至不知道JIRA究竟是什么。

发生这种情况是因为您使用的API在运行时需要Jakarta Commons的HTTPClient。 commons-httpclient是否包含在运行时类路径中? (你不需要编译)

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM