I've tripped over this problem today, and have figured out what is going on.

The latest Debian release 3.1-2 of the xmlrpc-client-3.1.jar contained a change to allow the current release version of the library to be included in the client's user agent string, instead of hard-coding a more generic user agent string in the XmlRpcHttpTransport.java file.

This change was implemented by adding an XmlRpcClient.properties file to the org/apache/xmlrpc/client directory which has a property named user.agent with the actual user agent string to use. The XmlRpcHttpTransport class was modified to look for this property file in that location and use the user.agent property contained therein as its USER_AGENT string.

Presumably, whatever tool that is used to create the xmlrpc-client.jar file is supposed to create or update the XmlRpcClient.properties file with the current version that is being built, but it turns out in the Debian release, at least, the XmlRpcClient.properties file was not included in the jar, which results in the ungraceful failure you (and I) observed.

I worked around this by adding an XmlRpcClient.properties file to my copy of the jar file.

It may not be a bad idea to add a fallback mechanism in the XmlRpcHttpTransport class in the event the XmlRpcClient.properties file is inadvertently forgotten in the future which will use a default hard coded user agent string if the attempt to load from the properties file fails for any reason, and maybe log some kind of warning.


On Mar 28, 2010 at 09:39pm, djlewis78 wrote:
=========================================================================

Hi all,

I have been running a very standard client from the apache libraries and
have found with the latest release that came through from Debian Testing to
have issues when using the client below.

XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();

try {
    config.setServerURL(new URL(xmlrpcServerUrl));
    config.setEnabledForExtensions(true);
    config.setConnectionTimeout(60 * 1000);
    config.setBasicUserName(xmlrpcBasicUserName);
    config.setBasicPassword(xmlrpcBasicPassword);

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

    return (Object) client.execute(endPoint, params);

} catch (XmlRpcException ex) {

    return ex.getMessage();
// return "Error: " + new CrossroadFaults().getMessage(ex.getMessage());

} catch (MalformedURLException ex) {
    return ex.getMessage();
//return "An Error has occured, please contact the System Administrator";
} catch (Exception ex) {
    return ex.getMessage();
//return "An Error has occured, please contact the System Administrator";
}

The errors that i have been recieving are

Exception in thread "main" java.lang.ExceptionInInitializerError
        at
org.apache.xmlrpc.client.XmlRpcSun15HttpTransportFactory.getTransport(XmlRpcSun15HttpTransportFactory.java:59)
        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 xmlrpcclient.Utilities.make_XMLRPC_Call(Utilities.java:35)
        at xmlrpcclient.testClient.showRun(testClient.java:227)
        at
xmlrpcclient.testClient.main(testClient.java:59)XmlRpcClient.properties
Caused by: java.lang.IllegalStateException: Failed to locate resource:
XmlRpcClient.properties
        at
org.apache.xmlrpc.client.XmlRpcHttpTransport.<clinit>(XmlRpcHttpTransport.java:70)
        ... 8 more
Java Result: 1


This is run with Netbeans and is easily fixed by reverting back to the
previous version of apache xmlrpc.

Are there any sugestions? I noticed that it is looking for the
'XmlRpcClient.properties' file in the path but this has been written
programatically.

Any ideas?

Daniel

Reply via email to