Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Communication problem between MICO and JacORB

10 views
Skip to first unread message

T Conrad

unread,
Dec 13, 2001, 12:39:21 PM12/13/01
to
Hello:

I am another new one to the CORBA world. I am having a problem getting a
JacORB client to talk to a MICO server. The JacORB client (LUTGT_Client)
and the MICO server (LUTGT_Server) are both running on the same SGI computer
under IRIX (IRIX64). The error message from the client is:

-------error message-----------------------------------------------
LUTGT_Client
JacORB V 1.3.30, www.jacorb.org
(C) Gerald Brose, FU Berlin, 13 June 2001
[ InterceptorManager started with 0 SIs, 0 CIs and 1 IORIs ]

After ORB.init
After resolve_initial_references
After Naming Context
After Name
name(0) = org.omg.CosNaming.NameComponent@f34912ec....
[ New connection to 155.157.20.64:7753 ]

*** Exception caught. ***
Message: org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming
/NamingContext/NotFound:1.0....

org.omg.CosNaming.NamingContextPackage.NotFound: IDL:omg.org/CosNaming/NamingCon
text/NotFound:1.0
at org.omg.CosNaming.NamingContextPackage.NotFoundHelper.read(Unknown So
urce)
at org.omg.CosNaming._NamingContextExtStub.resolve(Unknown Source)
at LUTGT_Client.main(LUTGT_Client.java:38, Compiled Code)
-------end of error message----------------------------------------

How do I cause the client to "find" the server? And how does the client
know to connect to 155.157.20.64:7753? I never gave it this port number.
Any help will be much appreciated. More info follows.

---T. Conrad

The server program (LUTGT_Server.cc) is:
-------server program----------------------------------------------
#include "LUTGT.h"
#include "LUTGT_impl.h"

#include <mico/include/mico/CosNaming.h>

int main (int argc, char* argv []) {
// ORB initialization
CORBA::ORB_var orb = CORBA::ORB_init (argc, argv, "mico-local-orb");
if (CORBA::is_nil (orb)) {
cout << "LUTGT_Server:Error obtaining CORBA::ORB_var orb" << endl;
}

// POA initialization
CORBA::Object_var poa_obj = orb->resolve_initial_references ("RootPOA");

// Downcast the POA object to a POA variable
PortableServer::POA_var poa = PortableServer::POA::_narrow (poa_obj);
if (CORBA::is_nil (poa)) {
cout << "LUTGT_Server:Error obtaining PortableServer::POA_var poa"
<< endl;
}

// POA manager
PortableServer::POAManager_var poa_mgr = poa->the_POAManager ();
if (CORBA::is_nil (poa_mgr)) {
cout
<< "LUTGT_Server:Error obtaining PortableServer::POAManager_var poa_mgr"
<< endl;
}
// Create (incarnate) instance of LUTGT implementation class (servant)
LUTGT_impl *LUTGT_servant = new LUTGT_impl;

// Activate the servant
PortableServer::ObjectId_var LUTGT_obj_id =
poa->activate_object (LUTGT_servant);

// Obtain a reference (pointer) to the servant object id to use later
// to bind to the name for advertising service.
CORBA::Object_var LUTGT_ref = poa->id_to_reference (LUTGT_obj_id.in());

// Activate the POA manager to wait for requests
poa_mgr->activate ();


// *********** Naming Service ********************************
// Get the Naming Context object
//cout << "Before resolve_initial_references (NameService)" << endl;
CORBA::Object_var naming_context_obj =
orb->resolve_initial_references ("NameService");
//cout << "After resolve_initial_references (NameService)" << endl;
if (CORBA::is_nil (naming_context_obj)) {
cout <<
"LUTGT_Server:Error obtaining CORBA::Object_var naming_context_obj"
<< endl;
}

// Downcast the naming context object to a naming context variable
//cout << "Before NamingContext::_narrow" << endl;
CosNaming::NamingContext_var naming_context =
CosNaming::NamingContext::_narrow (naming_context_obj);
//cout << "After NamingContext::_narrow" << endl;
if (CORBA::is_nil (naming_context)) {
cout <<
"LUTGT_Server:Error obtaining CosNaming::NamingContext_var naming_context
"
<< endl;
}
// Create and initialize the name
CosNaming::Name name;
name.length (1);
name[0].id = CORBA::string_dup ("LUTGT");
name[0].kind = CORBA::string_dup (""); // No specific kind

// Use rebind so we don't get an error if already bound.
naming_context->rebind (name, LUTGT_ref);
// *********** Naming Service ********************************

// Enter the ORBs event loop
cout << "Starting LUTGT_Server" << endl;
orb->run ();

// Destroy the POA, ORB, and servant (release method?)
poa->destroy (TRUE, TRUE);
orb->shutdown (TRUE);
orb->destroy ();
delete LUTGT_servant;

return 0;
}
-------end of server program---------------------------------------


The client program (LUTGT_Client.java) is:
-------client program----------------------------------------------
import java.io.*;
import org.omg.CosNaming.*;
import LUTGT.*;
//import LUTGT._Input_SelectionsStub.java;

public class LUTGT_Client
{
public static void main( String[] args )
{
org.omg.CORBA.IntHolder stat;
org.omg.CORBA.StringHolder error_msg;

try
{
org.omg.CORBA.ORB orb = org.omg.CORBA.ORB.init(args,null);
System.out.println("\nAfter ORB.init");

org.omg.CORBA.Object ncobj =
orb.resolve_initial_references("NameService");
System.out.println("After resolve_initial_references");

// Use NamingContextExt instead of NamingContext because of
// bugs in JDK 1.2.
NamingContextExt nc = NamingContextExtHelper.narrow (ncobj);
System.out.println("After Naming Context");
if( nc == null ) System.err.println("*** Naming Context variable nc
is null. ***");
NameComponent[] name = new NameComponent[1];
// name[0] = new NameComponent("LUTGT", "server");
// tried "server", "client", "service", "context", "", "whatever"
// and all failed
name[0] = new NameComponent("LUTGT", "");
System.out.println("After Name");
System.out.println(" name(0) = " + name[0] + "...." );

org.omg.CORBA.Object LUTGT_obj = nc.resolve(name);
Input_Selections client =
Input_SelectionsHelper.narrow(LUTGT_obj);

client.Set_RT_Model_Type ("6S");
System.out.println("After Set_RT_Model_Type");

client.Set_Run_Type ("Full");
System.out.println("After Set_Run_Type");

client.Set_Run_Data ("Aerosol_Reflectance_TestRun_Scenario7_V1");
System.out.println("After Set_Run_Data");

stat = new org.omg.CORBA.IntHolder ();
error_msg = new org.omg.CORBA.StringHolder (" ");
client.Run_LUTGT (stat, error_msg);
System.out.println("stat:" + stat);
System.out.println("error_msg:" + error_msg);
System.out.println("After Run_LUTGT");

}
catch ( Exception e )
{
System.err.println( "\n *** Exception caught. ***\n" +
" Message: " + e + "....\n" );
e.printStackTrace();
}
}
}
-------end of client program---------------------------------------


The (abbreviated) jacorb.properties file is:
-------abbreviated properties file---------------------------------
########################################
# #
# Initial references configuration #
# #
########################################

#
# URLs where IORs are stored (used in orb.resolve_initial_service())
# DO EDIT these! (Only those that you are planning to use,
# of course ;-).
#
# The ORBInitRef references are created on ORB startup time. In the
# cases of the services themselves, this may lead to exceptions being
# displayed (because the services aren't up yet). These exceptions
# are handled properly and cause no harm!

#ORBInitRef.NameService=corbaloc::160.45.110.41:38693/StandardNS/NameServer%2DPO
A/_root
#ORBInitRef.NameService=file:/c:/NS_Ref
ORBInitRef.NameService=file:/usr/public/LUTGT/corba/NS_Ref
# orig: ORBInitRef.NameService=http://www.x.y.z/~user/NS_Ref
#ORBInitRef.NameService=http://155.157.20.64:31328/LUTGT/corba/NS_Ref
#ORBInitRef.TradingService=http://155.157.20.64:31328/LUTGT/corba/TraderRef

# JacORB-specific URLs
jacorb.ProxyServerURL=http://155.157.20.64:31328/LUTGT/corba/Appligator_Ref

###########################################
# #
# Proxy address in IOR #
# #
###########################################

#
# with these two properties it is possible to
# tell the ORB what IP/port IORs should contain,
# if the ServerSockets IP/port can't be used
# (e.g. for traffic through a firewall).
#
# WARNING: this is just "dumb" replacing, so you
# have to take care of your configuration!
#

# orig: jacorb.ior_proxy_host=1.2.3.4
# orig: jacorb.ior_proxy_port=4711
jacorb.ior_proxy_host=155.157.20.64
jacorb.ior_proxy_port=12456
-------end of abbreviated properties file--------------------------


Command used to start the MICO Name Server Daemon:
nsd -ORBNoCodeSets -ORBIIOAddr inet:155.157.20.64:12456 &

The same error occured when the JacORB name server was running or not running.

Command used to start LUTGT_Server:
LUTGT_Server -ORBInitRef NameService=corbaloc::155.157.20.64:12456/NameService &

Command used to start LUTGT_Client:
jaco LUTGT_Client

This is MICO version 2.3.6.

0 new messages