by Yakov Gerlovin <yakov.gerlovin@[EMAIL PROTECTED]
>
Jul 23, 2007 at 10:39 AM
Hello,
Narrow is a safe downcast, meaning that you receive the object
only if it's of the required type (or type, derived from it). In your
case it looks like you provide the object that is not of type
com.pikeelectronic.calc.CORBAClient.Calculator
that is probably the reason for the exception.
Naming service is used to retrieve (resolve) object references by
logical name. This is very similar to DNS that resolves hostname (like
www.google.com) to some IP address.
Typically the sequence for using naming service is like this
1. The server connects to the Naming servive and publishes (using
'bind' method) the object reference under some path
2. The client creates NamingContext proxy (that represents the Naming
Service).
3. Using this proxy the client connects to this Naming Service and
resolves the object reference by specifying same path
4. The clients narrows the object reference to expected type.
To summarize, please make sure
corbaloc::localhost:40000/MyService
resolves to the
com.pikeelectronic.calc.CORBAClient.Calculator
object. If not, please consult with server's documentation on how to
retrieve the object reference. Some servers saves the stringified form
of object reference in file.