I think I’ve made a very little progress with this. The problem seems to lie
with method
org.apache.tuscany.sca.binding.rmi.provider.RMIReferenceInvoker#invokeTarget(Object)
In particular the method does the following:
if (proxy == null) {
proxy = rmiHost.findService(host, port, svcName);
// proxy = Naming.lookup(serviceURI);
}
remoteMethod = proxy.getClass().getMethod(remoteMethod.getName(),
remoteMethod.getParameterTypes());
if (payload != null && !payload.getClass().isArray()) {
return remoteMethod.invoke(proxy, payload);
} else {
return remoteMethod.invoke(proxy, (Object[])payload);
}
When I leave out the proxy == null check, which means I always lookup the
service from the rmiHost,
everything works fine. Now I guess that would slow down everything considerably
in the normal case.
But perhaps some exception handling along the lines suggested by the Spring RMI
client implementation
could be added to this method. What do you think?
-- Sebastian
________________________________
发件人: Millies, Sebastian
发送时间: 2011-03-15 20:43:34
收件人: [email protected]
抄送:
主题: Tuscany 1.6 RMI bug: ConnectException after component restart
Hello there,
I believe the following is a bug in the Tuscany 1.6 RMI binding:
When I have a network of components connected by RMI references,
then restarting a component will cause a java.net.ConnectException
in all dependent components on the next remote method call.
I suspect some kind of connection factory caches out-of-date information.
If it's a bug, it's a serious one, because it goes right against one main
reason for using distributed components in the first place.
Example:
ServerComponent exposes service "Server" with an RMI binding on port 8777.
ClientComponent exposes service "Client" with an RMI binding on port 8666
and has a reference to the service "Server".
Tester is a non-SCA Java class that exercises the Client service over RMI.
Everything works fine until the ServerComponent Java process is stopped
and re-started. The tester will then fail, because the client cannot
re-establish the connection to the server.
I have attached a zip-file with the example. Steps to reproduce the problem:
Run ServerLauncher
Run ClientLauncher
Run ClientTest
Stop process in which server is running
Re-Run ServerLauncher
Re-Run ClientTest
Has anyone else encountered this? Is it really a bug in Tuscany or in some
other component? Is there a workaround? Should I open a JIRA?
-- Sebastian