Below is my code to integrate with bugzilla and i am getting exception
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 is :
I have scucessfully logged in but when i run conn.executeMethod(report); i get below error.
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.xmlrpc.parser.XmlRpcResponseParser.getErrorCause()Ljava/lang/Throwable; at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:195) at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156) at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:143) at org.apache.xmlrpc.client.XmlRpcSunHttpTransport.sendRequest(XmlRpcSunHttpTransport.java:69) at org.apache.xmlrpc.client.XmlRpcClientWorker.execute(XmlRpcClientWorker.java:56) at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:167) at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:137) at org.apache.xmlrpc.client.XmlRpcClient.execute(XmlRpcClient.java:126) at com.j2bugzilla.base.BugzillaConnector.executeMethod(BugzillaConnector.java:164) at bugzillaTest.main(bugzillaTest.java:92)
l got fix this issue as below