views:

21

answers:

1

I'm in the middle of a crisis.

How can i register a object in configuration file multiple times?

Its simple i have server1, server2 and server3 that have the object (SomeObject) and i would like to do something like this on Clients configuration file:

<client>
    <wellknown type="IRemCalc.ICalc, IRemCalc"
            url="http://localhost:12234/RemoteCalc1.soap" />
    <wellknown type="IRemCalc.ICalc, IRemCalc"
    url="http://localhost:1234/RemoteCalc1.soap"/&gt;
</client>

But it throws me an exception saying that i cant register the same object twice, any solutions?

This is for a school work and I'm dying here.

A: 

Remoting is obsolete now, and I haven't used it for many years. Still, if I remember correctly, you in fact cannot register the same type multiple times.

Registering a type makes sure that when you use "new type()" in your code, it will create a remoting proxy instead of the actual type. That proxy will naturally address a single remote server.

If you need to use multiple servers, then you'll have to "manually" create proxy instances. As I said, I haven't used Remoting since about 2004, so I don't remember the API for manually creating a proxy.

John Saunders
Thakz for the help, but this question is from a work that i have to do to college, i know that is obsolete but my teechers still live in the past what i have to do...The questions simples says that without changing any code, configure the client configuration file so that is possible to use 3 servers for some object insted of one . . .
Trent Acid
@Trent: obviously impossible without changing code. Consider: what would change to make it use server 2 instead of server 1? Magic?
John Saunders
in execution time is easy, just get the proxy by Activator.getInstance with different urls but in the config files just dont know
Trent Acid
@Trent: there is no way to do it with configuration and with no code change.
John Saunders