[Prev][Next][Index][Thread]

jdk1.2 client wants to connect to orbix naming service



Hi,
I am trying to connect my jdk 1.2 client to an orbix naming service,
using ior file.

The code is as following:

import java.io.*;

import java.util.Properties;
import org.omg.CORBA.*;
import org.omg.CosNaming.*;

import UMSException;
import ConverterMgmt.ConverterHelper;

public class TestJavaIOR {

public static ConverterMgmt.Converter cvRef = null;


    public static void main ( String[] args ) {
 try {
     Properties props = new Properties();
     props.put("org.omg.CORBA.ORBClass","com.sun.CORBA.iiop.ORB");
     //props.put("org.omg.CORBA.ORB","org.omg.CORBA.ORB");
     ORB orb = ORB.init(args,props);
     NamingContext nc;
     if(args.length>0)
  {// first arg is the name of the NameService IOR File
      FileReader fr = new FileReader(args[0]);
      BufferedReader br = new BufferedReader(fr);

      String nsior = br.readLine();
      System.out.println("nsior: " + nsior);

      nc     = NamingContextHelper.narrow(orb.string_to_object(nsior)) ;

  }
     else
  {// if no argument, try default NameService
      System.out.println("else!!! -->  ior.txt not used!!");

      nc =
NamingContextHelper.narrow(orb.resolve_initial_references("NameService"))
;
  }

     System.out.println("NameComponent********:");

     NameComponent [] name = new NameComponent[3];
     name[0] = new NameComponent("UMS", "");
     name[1] = new NameComponent("Configuration", "");
     name[2] = new NameComponent("Converter", "");

     System.out.println("******NameComponent: "+ name);

    //error occurs here:
     org.omg.CORBA.Object obj = nc.resolve(name) ;
     System.out.println("obj:" + obj);

     cvRef = ConverterMgmt.ConverterHelper.narrow(obj);

     System.out.println("Converter Reference:" +cvRef);
 }
 catch (org.omg.CosNaming.NamingContextPackage.NotFound e) {
     e.printStackTrace(System.err);

     System.err.println("org.omg.CosNaming.NamingContextPackage.NotFound
(uli): "+ e.why.value());   }
 catch (Exception e) {
     e.printStackTrace(System.err);
 }
    }
}

I get following the error from the line "org.omg.CORBA.Object obj =
nc.resolve(name) ;"

org.omg.CORBA.COMM_FAILURE:   minor code: 1  completed: No
        at com.sun.CORBA.iiop.ConnectionTable.get(Compiled Code)
        at com.sun.CORBA.iiop.GIOPImpl.createRequest(Compiled Code)
        at com.sun.CORBA.iiop.GIOPImpl.createRequest(Compiled Code)
        at com.sun.CORBA.idl.GenericCORBAClientSC.createRequest(Compiled
Code)
        at com.sun.CORBA.idl.RequestImpl.doInvocation(Compiled Code)
        at com.sun.CORBA.idl.RequestImpl.invoke(Compiled Code)
        at org.omg.CosNaming._NamingContextStub.resolve(Compiled Code)
        at TestJavaIOR.main(Compiled Code)

Can someone tell me what is wrong in my code?
An example code would be also useful.
Thank a lot in advance

Happy New Year!

Min

pls. mailto:mti@fokus.gmd.de




Follow-Ups: