Sorry for the delay answering this question : it was lost in the stack...

Cyril Labbe wrote:

> Using David, I need to build an object connected to two different ORB.
> With Jonathan_2_0_5, I could do something like that :
>
> Properties prop_loc = new Properties();
> Properties prop_dis = new Properties();
> prop_loc.setProperty("david.naming.default_method","0");
> prop_loc.setProperty("david.naming.default_host",machine_loc);
> prop_loc.setProperty("david.naming.default_port",port_loc);
> prop_dis.setProperty("david.naming.default_method","0");
> prop_dis.setProperty("david.naming.default_host",machine_dist);
> prop_dis.setProperty("david.naming.default_port",port_dist);
> orb_dist = ORB.init(args2,prop_dis);
> orb_local = ORB.init(args2,prop_loc);
> org.omg.CORBA.Object ns_ref_dist =
>
> orb_dist.resolve_initial_references("NamingService");
> org.omg.CORBA.Object ns_ref_loc =
>
> orb_local.resolve_initial_references("NamingService");
>
> Trying this with Jonathan_3_0_a(2), it fails with an
> org.omg.CORBA.COMM_FAILURE
> exception : everything happens as if my properties are not taken into
> account !
>
> To my opinion the problem comes from the
> org.objectweb.david.ORBClass.set_parameters(String[] args, Properties
> props)
> method which don't use its argument props !
>
> Am I right ? If not, what should I do ?

You're right. But this is not really a bug. The properties specified as
an argument to ORB.init() are no longer transmitted to the ORB. This was
a non standard feature, and a bit problematic to keep with the new
configuration mechanism.

If I understand well what you want to do, you don't really need two
different ORBs, you just need two NamingServices using that ORB. This can
be done by defining a second naming service associated with your ORB.
Here is how you can do so :

In a jonathan.xml file, present in your classpath, type the following (I
assume you use the lastest Jonathan version, updated very recently on the
ObjectWeb CVS server) :

<CONFIGURATION>
    <ELEM name="trader/local_ns"><CONFIGURATION>
        <!-- defines a new CosNaming instance, obtained using the factory
named /david/CosNaming/factory, defined
              in the Kernel.xml file, and the current (".") configuration
elements (default_*) -->
        <ELEM name="instance"><ASSEMBLAGE
factory="/david/CosNaming/factory" configuration="."/></ELEM>

        <!-- the configuration parameters for the newly defined CosNaming
instance -->
        <ELEM name="default_method"><PROPERTY type="int"
value="0"/></ELEM>
        <ELEM name="default_host"><PROPERTY type="String"
value="machine_loc" /></ELEM>
       <ELEM name="default_port"><PROPERTY type="int" value="port_loc"
/></ELEM>
    </CONFIGURATION></ELEM>

    <!-- this registers /trader/local_ns/instance (i.e., the CosNaming
instance defined above as an ORB service
          -- at least with the IIOP ORB --, under the name "LOCAL_NS" -->

    <ELEM name="david/orbs/iiop/initial_services/LOCAL_NS"><ALIAS
name=/trader/local_ns/instance"/></ELEM>
</CONFIGURATION>

Once this is done, you have to modify your application in the folllowing
way :

ORB orb = ORB.init(args2,null);

// retrieves the standard naming service
org.omg.CORBA.Object ns_ref_dist =
orb.resolve_initial_references("NamingService");
// retrieves the local naming service
org.omg.CORBA.Object ns_ref_loc =
orb.resolve_initial_references("LOCAL_NS");

You have to parameterize correctly the NamingService so that the
appropriate settings are used. This can be done on the command line,
using the following options :

-Ddavid.CosNaming.default_method=0
-Ddavid.CosNaming.default_port=port_dist
-Sdavid.CosNaming.default_host=host_dist

Note thatyou can also modify the settings used for your Local NS using :

-Dtrader.local_ns.default_port=new_port_dist
-Strader.local_ns.default_host=new_host_dist

You could also change the retrieval method using the same mechanism.

Hope this helps,

Bruno
begin:vcard 
n:Dumant;Bruno 
tel;cell:06 75 20 76 64
tel;fax:33 4 37 49 63 91
tel;work:33 4 37 49 63 94
x-mozilla-html:FALSE
url:www.kelua.com
org:Kelua
adr:;;9 chemin de la Brocardi�re;Dardilly;;69570;France
version:2.1
email;internet:[EMAIL PROTECTED]
x-mozilla-cpt:;1
fn:Bruno Dumant
end:vcard

Reply via email to