ws-xmlrpc-auto mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chris Cooper (JIRA)" <>
Subject [jira] Commented: (XMLRPC-178) ClassCastException in client proxy cannot cast Ljava.lang.Object to Ljava.lang.String
Date Tue, 13 Oct 2009 14:29:31 GMT


Chris Cooper commented on XMLRPC-178:

Just to add a comment, when I debug the code at the line
TypeConverter typeConverter = typeConverterFactory.getTypeConverter(pMethod.getReturnType());

when I look at pMethod variable, return type is indeed "class [Ljava.lang.String;"

> ClassCastException in client proxy cannot cast Ljava.lang.Object to Ljava.lang.String
> -------------------------------------------------------------------------------------
>                 Key: XMLRPC-178
>                 URL:
>             Project: XML-RPC
>          Issue Type: Bug
>          Components: Releases
>    Affects Versions: 3.1.2
>         Environment: Windows Server 2003
>            Reporter: Chris Cooper
> I have a fairly simple client server application. One of my exposed server methods returns
a String[]. I am getting a ClassCastException on the client side when getting the result.
The class cast exception occurs in ClientFactory.class in the newInstance function. I am stepping
through the code, and it happens on the line "return typeConverter.convert(result);". Stepping
into this function hasn't really helped as it causes the ClassCastException. I am not sure
what the problem is, on the server side I have debugged and determined that my function is
indeed returning a String[] as it should be, but for some reason when it comes over to the
client side there is a problem. I can post you the stack trace:
> Exception in thread "main" java.lang.ClassCastException: [Ljava.lang.Object; cannot be
cast to [Ljava.lang.String;
> 	at $Proxy1.getInstances(Unknown Source)
> 	at com.rsa.grinderbot.controller.perfmon.WindowsProxy.getInstances(
-> this is the proxy object calling my server's function
> 	at com.rsa.grinderbot.controller.perfmon.WindowsStats.<init>(
> 	at com.rsa.grinderbot.controller.perfmon.PerformanceMonitor.<init>(
> 	at
> 	at com.rsa.grinderbot.controller.Controller.main(
> Here is my constructor that creates the proxy object using the client factory.
> public WindowsProxy(Server server) {
> 		this.server = server;
> 		XmlRpcClientConfigImpl config = new XmlRpcClientConfigImpl();
> 		try {
> 			config.setServerURL(new URL("http://" + server.getHostname() + ":" + server.getPort()
+ "/xmlrpc"));
> 			config.setReplyTimeout(0);
> 			config.setConnectionTimeout(0);
> 			XmlRpcClient client = new XmlRpcClient();
> 		    client.setConfig(config);
> 		    ClientFactory factory = new ClientFactory(client);
> 		    windows = (WindowsServerAPI) factory.newInstance(WindowsServerAPI.class);
> 		} catch (MalformedURLException e) {
> 			//TODO log4j
> 			e.printStackTrace();
> 		}
> 	}

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message