【问题标题】:"main" java.lang.NoSuchMethodError:“主要” java.lang.NoSuchMethodError:
【发布时间】:2013-12-13 06:47:28
【问题描述】:

以下是我与 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(report); 时出现以下错误。

线程“主”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)

【问题讨论】:

  • 请让这个问题可读。

标签: java selenium bugzilla


【解决方案1】:

添加以下所有 jar 并检查

xmlrpc-client-3.1.3

xmlrpc-common-3.1.3

xmlrpc-server-3.1.3

【讨论】:

  • 添加 ws-commons-util jar 并检查,它对我有用。我已经尝试使用您提供的代码正常工作。请让我知道它是否有效注意:确保您在“bugzillaurl”、“用户名”、“密码”中提供了有效的详细信息
  • @Sravan ,不幸的是现在我遇到了我的登录凭据不正确的问题。但同时我可以通过浏览器使用相同的用户名和密码登录 bugzilla。
  • 这真的很奇怪@Pramod,不知道您的代码可能有一个小问题,您可以重新检查它还是发布您的总代码,会检查
  • 替换登录 login=new LogIn(,"pramod.kg","123#er");使用登录 login=new LogIn("pramod.kg","123#er");以及替换 int id=login.getUserID(); 时的状态是什么?使用 conn.executeMethod(login);似乎最初您使用 conn.executeMethod(login);对吗?
  • sravan,我已经按照你所说的进行了更新,但我得到的仍然是登录问题。是因为如 j2bugzilla 网站中所说,“记住,你的 Bugzilla 安装必须为 XML 安装可选的 Perl 模块-RPC 调用。”
【解决方案2】:

我已经解决了这个问题,如下所示

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


}


}

【讨论】:

    猜你喜欢
    • 2011-07-21
    • 1970-01-01
    • 2021-06-12
    • 2011-02-20
    • 1970-01-01
    • 2011-06-17
    • 1970-01-01
    • 2019-06-18
    • 2018-08-02
    相关资源
    最近更新 更多