1

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)

1
  • 1
    Please make this question readable. Commented Dec 13, 2013 at 6:48

2 Answers 2

1

Add all the below jars and check

xmlrpc-client-3.1.3

xmlrpc-common-3.1.3

xmlrpc-server-3.1.3

Sign up to request clarification or add additional context in comments.

6 Comments

Add ws-commons-util jar and check, it is working for me. I have tried with the code you given working fine. Please let me know if it works Note: make sure you are providing valid details in "bugzillaurl","username","Password"
@ Sravan , unfortunately now i am getting issue that my login credantials are incorrct.But at same time i can log in to bugzilla with same username and password through browser.
That is really strange @Pramod , No Idea seems there might be a minor issue with your code can you recheck it or else post your total code, will check
replace LogIn login=new LogIn(,"pramod.kg","123#er"); with LogIn login=new LogIn("pramod.kg","123#er"); and Whats the status when you replace int id=login.getUserID(); with conn.executeMethod(login); Seems initially you used conn.executeMethod(login); right ?
sravan, i have updated as you said still login issue is what i am obtaining.Is it because as said in the j2bugzilla site, "Remember, your Bugzilla installation must have the optional Perl modules installed for XML-RPC calls."
|
1

l got fix this issue as below

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());}


}


}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.