Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

XML-RPC and JAVA

76 views
Skip to first unread message

Martin Langeder

unread,
Apr 30, 2009, 6:36:43 AM4/30/09
to support-...@lists.mozilla.org
Hallo

I'm trying to make a JAVA program for University that gets bug information from an existing bugzilla Database. But if I try to invoke the rpc massages I always get an ClassCastException.
Hopefully someone can help me out.

Here is the code:


import java.net.MalformedURLException;
import java.net.URL;
import org.apache.xmlrpc.XmlRpcException;
import org.apache.xmlrpc.client.*;
import java.util.*;

public class BugZillaConnection {

public static void main(String[] args) throws MalformedURLException {

URL url = new URL ("https://landfill.bugzilla.org/bugzilla-3.2-branch/xmlrpc.cgi");


try{
XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
config.setServerURL(url);

XmlRpcClient client = new XmlRpcClient();
client.setConfig(config);

String[] param = new String[] {"Product", "Printers"};

HashMap result = (HashMap)client.execute("Bugzilla.WebService.Bug.search", param);


}catch (Exception e) {
e.printStackTrace();
}

}

}

and the StackTrace from the Exception(s)

java.lang.ClassCastException: java.lang.String cannot be cast to java.lang.Integer
at org.apache.xmlrpc.parser.XmlRpcResponseParser.addResult(XmlRpcResponseParser.java:61)
at org.apache.xmlrpc.parser.RecursiveTypeParserImpl.endValueTag(RecursiveTypeParserImpl.java:78)
at org.apache.xmlrpc.parser.XmlRpcResponseParser.endElement(XmlRpcResponseParser.java:186)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.endElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanEndElement(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(Unknown Source)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(Unknown Source)
at com.sun.org.apache.xerces.internal.jaxp.SAXParserImpl$JAXPSAXParser.parse(Unknown Source)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.readResponse(XmlRpcStreamTransport.java:186)
at org.apache.xmlrpc.client.XmlRpcStreamTransport.sendRequest(XmlRpcStreamTransport.java:156)
at org.apache.xmlrpc.client.XmlRpcHttpTransport.sendRequest(XmlRpcHttpTransport.java:115)
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 connection.BugZillaConnection.main(BugZillaConnection.java:25)

0 new messages