gpt4 book ai didi

java - "main"java.lang.NoSuchMethodError :

转载 作者:太空宇宙 更新时间:2023-11-04 07:11:43 24 4
gpt4 key购买 nike

下面是我与 bugzilla 集成的代码,但我遇到了异常

import java.util.Map;
import com.j2bugzilla.base.Bug;
import com.j2bugzilla.base.BugFactory;
import com.j2bugzilla.base.BugzillaConnector;
import com.j2bugzilla.base.BugzillaMethod;
import com.j2bugzilla.rpc.LogIn;
import com.j2bugzilla.rpc.ReportBug;


public class bugzillaTest {


public static void main(String args[]) throws Exception {


//try to connect to bugzilla

BugzillaConnector conn;
conn=new BugzillaConnector();
conn.connectTo("http://bugzilllaurl");


LogIn login=new LogIn("pramod.kg","123#er");
conn.executeMethod(login);

int id=login.getUserID();
System.out.println("current user id"+id);

BugFactory factory=new BugFactory();


String component="Usability";
String description="this is a test desc";
String os="All";
String platform="PC";
String priority="High";
String product="MMNR7";
String summary="test summary";
String version="1.0";
Bug bugs= factory.newBug()
.setComponent(component)
.setDescription(description)
.setOperatingSystem(os)
.setPlatform(platform)
.setPriority(priority)
.setProduct(product)
.setSummary(summary)
.setVersion(version)
.createBug();

ReportBug report=new ReportBug(bugs);



try {

conn.executeMethod(report);
System.out.println("Bug is logged!");
} catch (Exception e) {
// TODO: handle exception

System.out.println("eror"+e.getMessage());
}
}
}

异常(exception)是:

我已成功登录,但当我运行 conn.executeMethod(report); 时,出现以下错误。

线程“main”中出现异常 java.lang.NoSuchMethodError: org.apache.xmlrpc.parser.XmlRpcResponseParser.getErrorCause()Ljava/lang/Throwable; 在 org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:195) 在 org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156) 在 org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143) 在 org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69) 在 org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56) 在 org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167) 在 org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137) 在 org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126) 在 com.j2bugzilla.base.BugzillaConnector.executeMethod(BugzillaConnector.java:164) 在 bugzillaTest.main(bugzillaTest.java:92)

最佳答案

添加以下所有 jar 并检查

xmlrpc-client-3.1.3

xmlrpc-common-3.1.3

xmlrpc-server-3.1.3

关于java - "main"java.lang.NoSuchMethodError :,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20560659/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com