0

JIRAを初めて使用します。EclipseIndigoおよびJIRA5.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ファイルもダウンロードしました。これは私のクラスパスファイルです(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がまだ正確に何であるかさえ知らない私の最初のプログラムになります。

4

1 に答える 1

2

これは、使用しているAPIが実行時にJakartaCommonsのHTTPClientを必要とするために発生します。commons-httpclientはランタイムクラスパスに含まれていますか?(コンパイルには必要ありません)

于 2012-10-30T05:56:48.233 に答える