2016-05-17 14 views
1

bei dem Versuch, einen neuen Fehler in Bugzilla zu schaffen, bin ich erhalte eine Fehlermeldung „Du musst angemeldet sein, bevor Sie diesen Teil von Bugzilla mit“Fehler beim Fehler in Bugzilla Erstellen Java mit

-Code wie

sieht
`HttpClient httpClient = new HttpClient(); 
    XmlRpcClient rpcClient = new XmlRpcClient(); 
    XmlRpcCommonsTransportFactory factory = new XmlRpcCommonsTransportFactory(rpcClient); 
    XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl(); 

    factory.setHttpClient(httpClient); 
    rpcClient.setTransportFactory(factory); 
    config.setServerURL(new URL("http://192.168.0.203/xmlrpc.cgi")); 
    rpcClient.setConfig(config); 

    // map of the login data 
    Map<String, String> loginMap = new HashMap<String, String>(); 
    loginMap.put("login", "[email protected]"); 
    loginMap.put("password", "[email protected]"); 
    loginMap.put("rememberlogin", "Bugzilla_remember"); 

    // login to bugzilla 
    Object loginResult = rpcClient.execute("User.login", new Object[]{loginMap}); 
    System.err.println ("loginResult=" + loginResult); 

    // map of the bug data 
    Map<String, String> bugMap = new HashMap<String, String>(); 

    bugMap.put("product", "Demo"); 
    bugMap.put("component", "Demo_project"); 
    bugMap.put("summary", "Bug created for test"); 
    bugMap.put("description", "This is text "); 
    bugMap.put("version", "unspecified"); 
    bugMap.put("op_sys", "Windows"); 
    bugMap.put("platform", "PC"); 
    bugMap.put("priority", "P2"); 
    bugMap.put("severity", "Normal"); 
    bugMap.put("status", "NEW"); 

    // create bug 
    Object createResult = rpcClient.execute("Bug.create", new Object[]{bugMap}); 
    System.err.println("createResult = " + createResult); 
` 

auf den ersten ich bin der Lage, um sich einzuloggen und die Antwort, die ich erhalten is-: loginResult = {id = 1, token = 1-AJ4uG13zlJ} aber, wenn ein neuer Fehler Fehler beim Erstellen tritt

`Exception in thread "main" org.apache.xmlrpc.XmlRpcException: You must log in before using this part of Bugzilla. 
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:197) 
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.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.abcd.BugCreator2.main(BugCreator2.java:52)` 

Warum erhalte ich diesen Fehler von Login wieder, wenn ich bereits in

Bearbeiten- angemeldet bin:

Der obige Code funktioniert gut, wenn auf https://bugzilla.mozilla.org Es scheint, dass es versucht, ist ein Problem, während Konfiguration von Bugzilla auf. lokaler Server.

Antwort

0

in erster Linie dank Ihnen i-Code gesucht wurde wie Ihre ...

und wenn Sie immer noch, dass die Fehlermeldung erhalten, sollen Sie wissen, dass Sie auch Login und Passwort müssen Parameter Methode für erstellen senden.

versuchen einfach so ..

hinzufügen, um dieses

bugMap.put("login", "[email protected]"); 
bugMap.put("password", "[email protected]"); 

vor diesem

bugMap.put("product", "Demo"); 
bugMap.put("component", "Demo_project"); 
bugMap.put("summary", "Bug created for test"); 
bugMap.put("description", "This is text "); 
bugMap.put("version", "unspecified"); 
bugMap.put("op_sys", "Windows"); 
bugMap.put("platform", "PC"); 
bugMap.put("priority", "P2"); 
bugMap.put("severity", "Normal"); 
bugMap.put("status", "NEW");