View Single Post
  #1 (permalink)  
Old 10-25-2004
yomi yomi is offline
Registered User
 
 
Join Date: Aug 2003
Posts: 32
Proxy checkcast failed.

Hi, I have a problem with c++ client to java server.

here is my java server code:
public void StartListen()
throws NwException
{
try
{
iAdapter = getCommunicator().createObjectAdapter("NwSpRes");
Ice.Object object = new NwSpResI();
iAdapter.add(object, Ice.Util.stringToIdentity("NwSpRes"));
iAdapter.activate();
//iCommunicator.waitForShutdown();
UniLog.getInstance().Log(UniLog.INFO, "listen NwSpRes ok");
}
catch (Exception ex)
{
throw new NwException("listen error");
}
}

here is my server config:
NwSpRes.Endpoints=tcp -h 0.0.0.0 -p 6672

when i use java client to get proxy ,it's ok:
private NwSpResPrx getNwSpResPrx()
throws NwException
{
if (nwspResPrx!=null)
return nwspResPrx;

try
{
String reqProxy = getProperties().getProperty("NwSpRes.Proxy");
Ice.ObjectPrx base = getCommunicator().stringToProxy(reqProxy);
if (base ==null)
{
throw new NwException("NwSpReqPrx create failed");
}
nwspResPrx = NwSpResPrxHelper.checkedCast(base.ice_twoway().ice _timeout(
25000).ice_secure(false));
if (nwspResPrx == null)
{
throw new NwException("NwSpReqPrx create failed");
}
return nwspResPrx;
}
catch (Ice.LocalException ex)
{
throw new NwException("create failed");
}
}

and the config is :
NwSpRes.Proxy=NwSpRes:tcp -h 127.0.0.1 -p 6672

but when i use c++ client:
nwice::NwSpResPrx CCterClientDlg::GetSpResPrx(void)
{
try
{
Ice::PropertiesPtr properties = m_ptrCommunicator->getProperties();
const char* proxyProperty = "NwSpRes.Proxy";
string proxy = properties->getProperty(proxyProperty);

if(proxy.empty())
{
MessageBox("ORB ERROR","ERROR");
return 0;
}

Ice::ObjectPrx base = m_ptrCommunicator->stringToProxy(proxy);

m_prxSpRes = NwSpResPrx::checkedCast(
base);

if(!m_prxSpRes)
{
MessageBox("NwSpResPrx failed","ERROR");
return 0;
}

return m_prxSpRes;
}
catch(...)
{
}
}

I CAN'T get the right proxy. m_prxSpRes is always point to null.
here is my client config:
NwSpRes.Proxy=NwSpRes:tcp -h 127.0.0.1 -p 6672
It's the same with java client.

here is the server side trace:
[ colorcat: Network: accepting tcp connections at 0.0.0.0:6672 ]
[ colorcat: Network: accepted tcp connection
local address = 127.0.0.1:6672
remote address = 127.0.0.1:2846 ]
[ colorcat: Protocol: sending validate connection
message type = 3 (validate connection)
compression status = 0 (not compressed; do not compress response, if any)
message size = 14 ]
[ colorcat: Protocol: received request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 61
request id = 1
identity = NwSpRes
facet =
operation = ice_isA
nonmutating = true
context = ]
[ colorcat: Protocol: sending reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 26
request id = 1
reply status = 0 (ok) ]
[ colorcat: Protocol: received close connection
message type = 4 (close connection)
compression status = 1 (not compressed; compress response, if any)
message size = 14 ]
[ colorcat: Network: closing tcp connection
local address = 127.0.0.1:6672
remote address = 127.0.0.1:2846 ]


here is the client side trace:
[ Network: tcp connection established
local address = 127.0.0.1:3019
remote address = 127.0.0.1:6672 ][ Protocol: received validate connection
message type = 3 (validate connection)
compression status = 0 (not compressed; do not compress response, if any)
message size = 14 ][ Protocol: sending request
message type = 0 (request)
compression status = 0 (not compressed; do not compress response, if any)
message size = 61
request id = 1
identity = NwSpRes
facet =
operation = ice_isA
idempotent = true
context = ][ Protocol: received reply
message type = 2 (reply)
compression status = 0 (not compressed; do not compress response, if any)
message size = 26
request id = 1
reply status = 0 (ok) ]


I don't know what happened . It seems communicator is ok. but error when downcast to the proxy type.

Please help.
Reply With Quote