[omniORB] Problem narrowing an omniorb object from java client with JavaIDL
Gustavo Madrigal
gustavo@worldwidevegas.com
Tue, 5 Jun 2001 02:15:55 -0600
Hi,
I'm a newbie to omniorb. I'm working in a project with a omniorb server
running under linux and I want the windows clients to use JavaIDL (Sun's ORB,
jre 1.3.1). But I'm having some problems narrowing an object reference from a
java client, below is all the info about one of my problems
..
I've been doing some tests with a simple component defined by this idl
interface:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
module EchoApp
{
interface Echo
{
string echoString(in string mesg);
};
};
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
The function echoString returns the a copy of the string it receives.
In the server I saved the object's IOR in a file, the server code looks like
this:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
CORBA::ORB_var orb = CORBA::ORB_init( argc, argv, "omniORB3" );
CORBA::Object_var obj = orb->resolve_initial_references( "RootPOA" );
PortableServer::POA_var poa = PortableServer::POA::_narrow( obj );
Echo_i* myecho = new Echo_i();
PortableServer::ObjectId_var myechoid = poa->activate_object( myecho );
CORBA::String_var ref = orb->object_to_string(obj);
ofstream ostr( "/tmp/echo.ref" );
ostr << ref;
ostr.close();
myecho->_remove_ref();
PortableServer::POAManager_var pman = poa->the_POAManager();
pman->activate();
orb->run();
orb->destroy();
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Then a sent the file to a windows computer, and tried this command from a DOS
prompt:
java EchoClient -ORBInitialHost <MyServer> -ORBInitialHost 8088
But I got the following error at line 40:
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
ERROR : org.omg.CORBA.BAD_PARAM: minor code: 0 completed: No
org.omg.CORBA.BAD_PARAM: minor code: 0 completed: No
at EchoApp.EchoHelper.narrow(EchoHelper.java:60)
at EchoClient.main(EchoClient.java:40)
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
The Java code for my client looks like this (The line 40 is indicated):
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args, null);
String ref = null;
try
{
BufferedReader in = new BufferedReader( new FileReader( "c:\\echo.ref" ) );
ref = in.readLine();
}
catch( IOException ex )
{
System.out.println( "Could not open file 'c:\\echo.ref'" );
System.exit( -1 );
}
System.out.println(ref);
org.omg.CORBA.Object objRef = orb.string_to_object( ref);
Echo echoRef = EchoHelper.narrow(objRef); /*************THIS IS LINE 40*/
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
What am I doing wrong? Any ideas?
Thanks,
Gustavo