下面是我与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());
}
}
}
例外是:
我已经进行了大量登录,但是当我运行 conn.executeMethod(报告); 时,我收到以下错误。
线程“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)
答案 0 :(得分:1)
添加以下所有罐子并检查
XMLRPC-客户3.1.3
XMLRPC-共3.1.3
XMLRPC - 服务器 - 3.1.3
答案 1 :(得分:0)
我解决了这个问题,如下所示
public class bugzillaTest {
private static final String COMP = "Usability";
private static final String DES = "this is a test desc";
private static final String OS = "All";
private static final String PLAT = "PC";
private static final String PRIO = "High";
private static final String PRO = "MMNR7";
private static final String SUM = "test summary";
private static final String VER = "1.0";
public static void main(String args[]) throws Exception {
// try to connect to bugzilla
BugzillaConnector conn;
BugFactory factory;
Bug bugs;
ReportBug report;
conn = new BugzillaConnector();
conn.connectTo("http://192.168.0.31/");
LogIn login = new LogIn("username", "password");
// create a bug
factory = new BugFactory();
bugs = factory
.newBug().
setOperatingSystem(OS)
.setPlatform(PLAT)
.setPriority(PRIO)
.setProduct(PRO)
.setComponent(COMP)
.setSummary(SUM)
.setVersion(VER)
.setDescription(DES)
.createBug();
report=new ReportBug(bugs);
try{conn.executeMethod(login);
conn.executeMethod(report);
}
catch(Exception e){System.out.println(e.getMessage());}
}
}