Hi,<br><br>I am new to CORBA and I am using OmniOrbPy to develop my skills. <br><br>I have a Server Client Implementation which works well when run on the same machine.<br> If I attempt to run the client on another machine I get errors. <br>
<br>Surprisingly, the code works well across machines if I comment out the lines <br><br> oClient = oORB.string_to_object("corbaname:rir:#oClient.obj")<br>
print oClient.GetState()<br><br>in the myserver.py implementation. <br><br>However, I need to read back the Client state for the application I am trying to develop. <br>The errors and full source code follows.<br>
<br>---8<---Error reported by client on different machine-----------------------<div id="1fd4" class="ArwC7c ckChnd">-----------------------------------------------------------------------<br><br>Traceback (most recent call last):<br>
File "myClient.py", line 36, in <module><br>
print oServer.GetState()<br> File "H:\a\ar\ar210\WindowsProfile\My Documents\SpringTerm\DS\Code\CallTest_idl.py", line 96, in GetState<br> return _omnipy.invoke(self, "GetState", _0_CallTest.imyServer._d_GetState, args)<br>
omniORB.CORBA.COMM_FAILURE: CORBA.COMM_FAILURE(omniORB.COMM_FAILURE_MarshalArguments, CORBA.COMPLETED_NO)<br><br>---8<---Error reported by server ----------------------------------------------------------------------------------------------<br>
<br>omniORB: Read from configuration file "server.cfg".<br>omniORB: Version: 4.1.1<br>omniORB: Distribution date: Sun Oct 7 16:41:47 BST 2007 dgrisby<br>omniORB: Warning: unable to create an IPv6 socket. Unable to obtain the list of IPv6 interface addresses (10047).<br>
omniORB: My addresses are:<br>omniORB: <a href="http://139.184.50.152/" target="_blank">139.184.50.152</a><br>omniORB: <a href="http://127.0.0.1/" target="_blank">127.0.0.1</a><br>omniORB: Maximum supported GIOP version is 1.2<br>
omniORB: Native char code sets: UTF-8 ISO-8859-1.<br>
omniORB: Transmission char code sets: UTF-8(1.2) UTF-8(1.1) ISO-8859-1(1.2) ISO-8859-1(1.1) ISO-8859-1(1.0).<br>omniORB: Native wide char code sets: UTF-16.<br>omniORB: Transmission wide char code sets: UTF-16(1.2).<br>omniORB: Information: the omniDynamic library is not linked.<br>
omniORB: Current configuration is as follows:<br>omniORB: DefaultInitRef (file) =<br>omniORB: DefaultInitRef (args) =<br>omniORB: InitRef = NameService=corbaname::<a href="http://aldgate.tn.informatics.scitech.sussex.ac.uk:8000/" target="_blank">aldgate.tn.informatics.scitech.sussex.ac.uk:8000</a><br>
omniORB: abortOnInternalError = 0<br>omniORB: abortOnNativeException = 0<br>omniORB: acceptBiDirectionalGIOP = 1<br>omniORB: acceptMisalignedTcIndirections = 0<br>omniORB: bootstrapAgentHostname =<br>omniORB: bootstrapAgentPort = 900<br>
omniORB: clientCallTimeOutPeriod = 0<br>omniORB: clientConnectTimeOutPeriod = 0<br>omniORB: clientTransportRule = * unix,ssl,tcp<br>omniORB: configFile = server.cfg<br>omniORB: connectionWatchImmediate = 0<br>omniORB: connectionWatchPeriod = 50000<br>
omniORB: copyValuesInLocalCalls = 1<br>omniORB: diiThrowsSysExceptions = 0<br>omniORB: dumpConfiguration = 0<br>omniORB: endPoint = giop:tcp::8002<br>omniORB: endPointPublish = addr<br>omniORB: giopMaxMsgSize = 2097152<br>
omniORB: giopTargetAddressMode = KeyAddr<br>omniORB: id = omniORB4<br>omniORB: idleThreadTimeout = 10<br>omniORB: inConScanPeriod = 180<br>omniORB: lcdMode = 0<br>omniORB: maxGIOPConnectionPerServer = 5<br>omniORB: maxGIOPVersion = 1.2<br>
omniORB: maxInterleavedCallsPerConnection = 5<br>omniORB: maxServerThreadPerConnection = 100<br>omniORB: maxServerThreadPoolSize = 100<br>omniORB: maxSocketRecv = 131072<br>omniORB: maxSocketSend = 131072<br>omniORB: nativeCharCodeSet = ISO-8859-1<br>
omniORB: nativeWCharCodeSet = UTF-16<br>omniORB: objectTableSize = 0<br>omniORB: offerBiDirectionalGIOP = 1<br>omniORB: oneCallPerConnection = 0<br>omniORB: outConScanPeriod = 120<br>omniORB: poaHoldRequestTimeout = 0<br>
omniORB: poaUniquePersistentSystemIds = 1<br>omniORB: principal = [Null]<br>omniORB: resetTimeOutOnRetries = 0<br>omniORB: scanGranularity = 5<br>omniORB: serverCallTimeOutPeriod = 0<br>omniORB: serverTransportRule = * bidir,unix,tcp,ssl<br>
omniORB: socketSendBuffer = 16384<br>omniORB: strictIIOP = 1<br>omniORB: supportBootstrapAgent = 0<br>omniORB: supportCurrent = 1<br>omniORB: supportPerThreadTimeOut = 0<br>omniORB: tcAliasExpand = 0<br>omniORB: threadPerConnectionLowerLimit = 9000<br>
omniORB: threadPerConnectionPolicy = 1<br>omniORB: threadPerConnectionUpperLimit = 10000<br>omniORB: threadPoolWatchConnection = 1<br>omniORB: traceExceptions = 1<br>omniORB: traceFile = [stderr]<br>omniORB: traceInvocationReturns = 0<br>
omniORB: traceInvocations = 0<br>omniORB: traceLevel = 25<br>omniORB: traceThreadId = 0<br>omniORB: traceTime = 0<br>omniORB: unixTransportDirectory = /tmp/omni-%u<br>omniORB: unixTransportPermission = 777<br>
omniORB: useTypeCodeIndirections = 1<br>omniORB: verifyObjectExistsAndType = 1<br>omniORB: omniORBpy distribution date: Sun Oct 7 16:38:58 BST 2007 dgrisby<br>omniORB: Python thread state scavenger start.<br>omniORB: Initialising incoming endpoints.<br>
omniORB: Instantiate endpoint 'giop:tcp::8002'<br>omniORB: Attempt to set socket to listen on IPv4 and IPv6.<br>omniORB: Unable to set socket to listen on IPv4 and IPv6. Fall back to just IPv4.<br>omniORB: Bind to address <a href="http://0.0.0.0/" target="_blank">0.0.0.0</a><br>
omniORB: Publish specification: 'addr'<br>omniORB: Try to publish 'addr' for endpoint giop:tcp:<a href="http://139.184.50.152:8002/" target="_blank">139.184.50.152:8002</a><br>omniORB: Publish endpoint 'giop:tcp:<a href="http://139.184.50.152:8002/" target="_blank">139.184.50.152:8002</a>'<br>
omniORB: Starting serving incoming endpoints.<br>omniORB: AsyncInvoker: thread id = 2 has started. Total threads = 1<br>omniORB: giopRendezvouser task execute for giop:tcp:<a href="http://139.184.50.152:8002/" target="_blank">139.184.50.152:8002</a><br>
omniORB: Adding root<0> (activating) to object table.<br>omniORB: State root<0> (activating) -> active<br>omniORB: Creating ref to local: root<0><br> target id : IDL:<a href="http://omg.org/CORBA/Object:1.0" target="_blank">omg.org/CORBA/Object:1.0</a><br>
most derived id: IDL:CallTest/imyServer:1.0<br>omniORB: Creating Python ref to local: root<0><br> target id : IDL:CallTest/imyServer:1.0<br> most derived id: IDL:CallTest/imyServer:1.0<br>omniORB: ObjRef(IDL:CallTest/imyServer:1.0) -- deleted.<br>
omniORB: Creating ref to remote: key<NameService><br> target id : IDL:<a href="http://omg.org/CORBA/Object:1.0" target="_blank">omg.org/CORBA/Object:1.0</a><br> most derived id:<br>omniORB: Initial reference `NameService' resolved from configuration file.<br>
omniORB: Creating Python ref to remote: key<NameService><br> target id : IDL:<a href="http://omg.org/CORBA/Object:1.0" target="_blank">omg.org/CORBA/Object:1.0</a><br> most derived id:<br>omniORB: Client attempt to connect to giop:tcp:<a href="http://aldgate.tn.informatics.scitech.sussex.ac.uk:8000/" target="_blank">aldgate.tn.informatics.scitech.sussex.ac.uk:8000</a><br>
omniORB: AsyncInvoker: thread id = 3 has started. Total threads = 2<br>omniORB: Scavenger task execute.<br>omniORB: Client opened connection to giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a><br>
omniORB: sendChunk: to giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 100 bytes<br>
omniORB: inputMessage: from giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 25 bytes<br>omniORB: Creating Python ref to remote: key<NameService><br> target id : IDL:<a href="http://omg.org/CosNaming/NamingContext:1.0" target="_blank">omg.org/CosNaming/NamingContext:1.0</a><br>
most derived id:<br>omniORB: ObjRef() -- deleted.<br>omniORB: LocateRequest to remote: key<NameService><br>omniORB: sendChunk: to giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 31 bytes<br>
omniORB: inputMessage: from giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 20 bytes<br>
omniORB: sendChunk: to giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 228 bytes<br>omniORB: inputMessage: from giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 24 bytes<br>
omniORB: Server accepted connection from giop:tcp:<a href="http://139.184.50.153:2098/" target="_blank">139.184.50.153:2098</a><br>
omniORB: AsyncInvoker: thread id = 5 has started. Total threads = 3<br>omniORB: giopWorker task execute.<br>omniORB: Accepted connection from giop:tcp:<a href="http://139.184.50.153:2098/" target="_blank">139.184.50.153:2098</a> because of this rule: "* bidir,unix,tcp,ssl"<br>
omniORB: inputMessage: from giop:tcp:<a href="http://139.184.50.153:2098/" target="_blank">139.184.50.153:2098</a> 38 bytes<br>omniORB: Handling a GIOP LOCATE_REQUEST.<br>omniORB: sendChunk: to giop:tcp:<a href="http://139.184.50.153:2098/" target="_blank">139.184.50.153:2098</a> 20 bytes<br>
omniORB: inputMessage: from giop:tcp:<a href="http://139.184.50.153:2098/" target="_blank">139.184.50.153:2098</a> 122 bytes<br>omniORB: Receive codeset service context and set TCS to (ISO-8859-1,UTF-16)<br>omniORB: receive bidir IIOP service context: ( <a href="http://139.184.50.153:2096/" target="_blank">139.184.50.153:2096</a> )<br>
omniORB: Accepted request from giop:tcp:<a href="http://139.184.50.153:2098/" target="_blank">139.184.50.153:2098</a> to switch to bidirectional because of this rule: "* bidir,unix,tcp,<br>sl"<br>omniORB: Creating new Python state for thread id 19820<br>
omniORB: Initial reference `NameService' resolved from configuration file.<br>omniORB: sendChunk: to giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 100 bytes<br>omniORB: inputMessage: from giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 25 bytes<br>
omniORB: Creating ref to remote: key<NameService><br> target id : IDL:<a href="http://omg.org/CosNaming/NamingContext:1.0" target="_blank">omg.org/CosNaming/NamingContext:1.0</a><br> most derived id:<br>omniORB: string_to_object attempting to resolve `oClient.obj' from naming service<br>
omniORB: sendChunk: to giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 80 bytes<br>omniORB: inputMessage: from giop:tcp:<a href="http://139.184.50.152:8000/" target="_blank">139.184.50.152:8000</a> 172 bytes<br>
omniORB: Creating ref to remote: root<0><br>
target id : IDL:<a href="http://omg.org/CORBA/Object:1.0" target="_blank">omg.org/CORBA/Object:1.0</a><br> most derived id: IDL:CallTest/imyClient:1.0<br>omniORB: ObjRef() -- deleted.<br>omniORB: Creating Python ref to remote: root<0><br>
target id : IDL:<a href="http://omg.org/CORBA/Object:1.0" target="_blank">omg.org/CORBA/Object:1.0</a><br> most derived id: IDL:CallTest/imyClient:1.0<br>omniORB: omniRemoteIdentity deleted.<br>omniORB: ObjRef(IDL:CallTest/imyClient:1.0) -- deleted.<br>
omniORB: LocateRequest to remote: root<0><br>omniORB: Client attempt to connect to giop:tcp:<a href="http://139.184.50.153:2096/" target="_blank">139.184.50.153:2096</a><br>omniORB: Client opened connection to giop:tcp:<a href="http://139.184.50.153:2096/" target="_blank">139.184.50.153:2096</a><br>
omniORB: sendChunk: to giop:tcp:<a href="http://139.184.50.153:2096/" target="_blank">139.184.50.153:2096</a> 38 bytes<br>omniORB: Switch rope to use address giop:tcp:<a href="http://139.184.50.153:2096/" target="_blank">139.184.50.153:2096</a><br>
omniORB: Error in network send: giop:tcp:<a href="http://139.184.50.153:2096/" target="_blank">139.184.50.153:2096</a><br>
omniORB: throw giopStream::CommFailure from giopStream.cc:1182(0,NO,COMM_FAILURE_MarshalArguments)<br>omniORB: Client connection refcount = 0<br>omniORB: Client close connection to giop:tcp:<a href="http://139.184.50.153:2096/" target="_blank">139.184.50.153:2096</a><br>
omniORB: Caught a CORBA system exception during up-call: IDL:<a href="http://omg.org/CORBA/COMM_FAILURE:1.0" target="_blank">omg.org/CORBA/COMM_FAILURE:1.0</a><br>Traceback (most recent call last):<br> File "myServer.py", line 19, in GetState<br>
print oClient.GetState()<br> File "H:\a\ar\ar210\WindowsProfile\My Documents\SpringTerm\DS\Code\CallTest_idl.py", line 46, in GetState<br> return _omnipy.invoke(self, "GetState", _0_CallTest.imyClient._d_GetState, args)<br>
omniORB.CORBA.COMM_FAILURE: CORBA.COMM_FAILURE(omniORB.COMM_FAILURE_MarshalArguments, CORBA.COMPLETED_NO)<br>omniORB: throw COMM_FAILURE from pyExceptions.cc:177 (NO,COMM_FAILURE_MarshalArguments)<br>omniORB: sendChunk: to giop:tcp:<a href="http://139.184.50.153:2098/" target="_blank">139.184.50.153:2098</a> 72 bytes<br>
omniORB: Error in network receive (start of message): giop:tcp:<a href="http://139.184.50.153:2098/" target="_blank">139.184.50.153:2098</a><br>omniORB: throw giopStream::CommFailure from giopStream.cc:874(0,NO,COMM_FAILURE_UnMarshalArguments)<br>
omniORB: Server connection refcount = 1<br>omniORB: select() returned WSAENOTSOCK / WSAEINVAL.<br>omniORB: Server connection refcount = 0<br>omniORB: Server close connection from giop:tcp:<a href="http://139.184.50.153:2098/" target="_blank">139.184.50.153:2098</a><br>
omniORB: Deleting Python state for thread id 19820 (thread exit)<br>omniORB: AsyncInvoker: thread id = 5 has exited. Total threads = 3<br>omniORB: Scanning Python thread states.<br>omniORB: Scavenger close connection to giop:tcp:<a href="http://139.184.50.152:3555/" target="_blank">139.184.50.152:3555</a><br>
omniORB: sendCloseConnection: to giop:tcp:<a href="http://139.184.50.152:3555/" target="_blank">139.184.50.152:3555</a> 12 bytes<br>omniORB: Client connection refcount (forced) = 0<br>omniORB: Client close connection to giop:tcp:<a href="http://139.184.50.152:3555/" target="_blank">139.184.50.152:3555</a><br>
omniORB: omniRemoteIdentity deleted.<br>omniORB: ObjRef(IDL:CallTest/imyClient:1.0) -- deleted.<br>Traceback (most recent call last):<br> File "myServer.py", line 41, in <module><br> oORB.run()<br> File "H:\a\ar\ar210\WindowsProfile\My Documents\SpringTerm\DS\Code\CORBA.py", line 587, in run<br>
<br>KeyboardInterrupt<br>omniORB: omniRemoteIdentity deleted.<br>omniORB: ObjRef() -- deleted.<br>omniORB: ObjRef(IDL:CallTest/imyServer:1.0) -- deleted.<br>omniORB: omniRemoteIdentity deleted.<br>omniORB: ObjRef() -- deleted.<br>
omniORB: ORB not destroyed; no final clean-up.<br><br><br>####################################################################################################<br><br>SOURCE CODE<br><br>--8<----------CallTest.idl------------------------------------------------------------------------------------------------------------------<br>
<br>module CallTest<br>{<br> interface imyClient<br> {<br> short GetState();<br> };<br> <br> interface imyServer<br> {<br> short GetState();<br> }; <br>};<br><br><br>--8<-------myServer.py---------------------------------------------------------------------------------------------------------------------<br>
<br><br>import sys<br>import CORBA<br><br>import CosNaming<br><br>import CallTest<br>import CallTest__POA<br><br>oORB = None<br><br>class myServer (CallTest__POA.imyServer):<br> def __init__(self):<br> self.State = 0<br>
<br> def GetState(self):<br> global oORB<br> <br> oClient = oORB.string_to_object("corbaname:rir:#oClient.obj")<br> print oClient.GetState()<br> <br> self.State = self.State + 5<br>
return self.State<br><br>oORB = CORBA.ORB_init(sys.argv,CORBA.ORB_ID)<br>oPOA = oORB.resolve_initial_references("RootPOA")<br>oPOA._get_the_POAManager().activate()<br><br>servantmyServer = myServer()<br>
oPOA.activate_object(servantmyServer)<br>objrefmyServer = servantmyServer._this()<br><br>oNameRoot = oORB.resolve_initial_references("NameService")<br>oNameRoot = oNameRoot._narrow(CosNaming.NamingContext)<br>if None == oNameRoot:<br>
print "Did not locate a valid naming service. Please check setup."<br> sys.exit(1)<br> <br>oName = [CosNaming.NameComponent("oServer","obj")]<br>oNameRoot.rebind(oName,objrefmyServer)<br>
<br>oORB.run()<br><br><br>--8<---------myClient.py--------------------------------------------------------------------------------------------------------------------------<br><br><br>import sys<br>import CORBA<br><br>
import CosNaming<br><br>import CallTest<br>import CallTest__POA<br><br>class myClient (CallTest__POA.imyClient):<br> def __init__(self):<br> self.State = 0<br> <br> def GetState(self):<br> self.State = self.State + 7<br>
return self.State <br><br>oORB = CORBA.ORB_init(sys.argv,CORBA.ORB_ID)<br>oPOA = oORB.resolve_initial_references("RootPOA")<br>oPOA._get_the_POAManager().activate()<br><br>servantmyClient = myClient()<br>
idClient = oPOA.activate_object(servantmyClient)<br>objrefmyClient = servantmyClient._this()<br><br>oNameRoot = oORB.resolve_initial_references("NameService")<br>oNameRoot = oNameRoot._narrow(CosNaming.NamingContext)<br>
if None == oNameRoot:<br> print "Did not locate a valid naming service. Please check setup."<br> sys.exit(1)<br> <br>oName = [CosNaming.NameComponent("oClient","obj")]<br>oNameRoot.rebind(oName,objrefmyClient)<br>
<br>oServer = oORB.string_to_object("corbaname:rir:#oServer.obj")<br><br>print oServer.GetState()<br><br>print "Client has finished"<br><br>---8<-------------------------------------------------------------------------------------------------------------------------<br>
<br><br>Kindly let me know the flaw in my approach. Please bear with any ignorance on my part as these concepts are new to me.<br>Any help would be appreciated.<br><br>Regards,<br><font color="#888888">Anup<br></font></div>