|
|
|
|||||
|
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. |
|
|||||
|
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. |
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | Rate This Thread |
|
|
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 |