Go Back   ZeroC Forums > Help Center

Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #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
  #2 (permalink)  
Old 10-25-2004
marc's Avatar
marc marc is offline
ZeroC Staff
 
Name: Marc Laukien
Organization: ZeroC, Inc.
Project: The Internet Communications Engine
 
Join Date: Feb 2003
Location: Florida
Posts: 1,781
I can't see anything wrong in the code. Are you sure you are using the same Slice code for both the client and the server? Also, can you double check that base is not null already?
Reply With Quote
  #3 (permalink)  
Old 10-25-2004
yomi yomi is offline
Registered User
 
 
Join Date: Aug 2003
Posts: 32
yes, yesterday I use the same ice file to compiler again.
I have checked base, base is not null.

I will write a simple test to debug.
thanks.
Reply With Quote
  #4 (permalink)  
Old 10-25-2004
yomi yomi is offline
Registered User
 
 
Join Date: Aug 2003
Posts: 32
Hi , I have made a little change with the generated java file.

I changed the package name.
Is it make sense?

in Java:
package nwice;
I changed to package com.nw.ice.

but not changed in c++.
it is still in nwice namespace.
Reply With Quote
  #5 (permalink)  
Old 10-25-2004
yomi yomi is offline
Registered User
 
 
Join Date: Aug 2003
Posts: 32
Oh , I get the reason.

I replaced all of the nwice namespace when I changed the package define.

Now I only replace "package nwice;" with "package com.nanwang.ice",
those "::nwice:.." in the code body is remained.

So the proxy can get correct type match.

Now everything is Ok.

Could anyone developing in java tell me how to make the package name correct naturelly. I means when compiled from ice, files can be directly placed into folds such as com/nw/ice.

Thanks.
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Failed to make on FC6 qhbo Help Center 4 11-15-2006 10:35 PM
IceJ regression test failed! rc_hz Help Center 2 12-23-2004 03:10 AM
Assertion failed nsns Bug Reports 10 12-01-2004 08:02 PM
ice compile failed with gcc-3.4.1 minifat Bug Reports 4 07-23-2004 06:01 AM
Connect failed HELP! alesio Help Center 1 02-24-2004 07:06 AM


All times are GMT -4. The time now is 05:16 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.0.0
(c) 2008 ZeroC, Inc.