javacorbajacorbnameservice

JacORB 3.2 NameService (ns) seems not to read "orb.properties" file


I've got a problem with JacORB 3.2 as it seems that it doesn't read the orb.properties file, and especially the ORBInitRef.NameService property.

As stated in the documentation on chapter 3.1, JacORB automatically searches for the orb.properties file in three locations: the "java.home"/lib directory, the "user.home" directory and inside the classpath.

This is the evidence that I'm not totally drunk:

Java command:

System.out.println(System.getProperty("java.home"));
System.out.println(System.getProperty("user.home"));

Output:

/usr/lib/jvm/jdk1.7.0/jre
/home/emanuele

Bash command:

ls /usr/lib/jvm/jdk1.7.0/jre/lib | grep orb.properties ; ls /home/emanuele | grep orb.properties

Output:

jacorb.properties
orb.properties
jacorb.properties
orb.properties

These four .properties file are exactly the same. Please have a look at the URI of the file that contains the reference (IOR) of the NameService:

ORBInitRef.NameService=file:/tmp/CORBA/NS_Ref

The problem is that, when I try to launch the NameService without any parameter (ns) I got these error messages:

giu 05, 2013 9:56:51 PM org.jacorb.naming.NameServer main
SEVERE: unexpected exception
java.io.FileNotFoundException: c:/NS_Ref (No such file or directory)
    at java.io.FileOutputStream.open(Native Method)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:212)
    at java.io.FileOutputStream.<init>(FileOutputStream.java:104)
    at org.jacorb.naming.NameServer.main(NameServer.java:320)

java.lang.RuntimeException: c:/NS_Ref (No such file or directory)
    at org.jacorb.naming.NameServer.main(NameServer.java:335)

Of course, if I explicitely pass the URI through console, everything goes fine

ns -Djacorb.naming.ior_filename=/tmp/CORBA/NS_Ref

The very strange thing is that, after the NameService is running, EVERY OTHER OBJECT can correctly and automatically resolve the initial reference of the NameService.

NamingContextExt nc = NamingContextExtHelper.narrow(orb.resolve_initial_references("NameService"));

The previous Java code returns a valid object. That does not make any sense for me. And why does the NameService try to write its IOR inside a random file like C:\NS_Ref while I'm on Linux?

Any idea?


Solution

  • I thing you mixed up some different things in your question.

    1. The location of the NS's IOR
    2. The ability to read and use this IOR by other programs

    First. Starting the NamingService is not affected by option ORBInitRef.NameService or any related commandline option. If you want the NamingService to drop it's IOR in a file, use

    # The file where the name server drops its IOR
    jacorb.naming.ior_filename=file:///tmp/CORBA/NS_Ref
    

    as you already did. If this behaves different when using this as cmdline option, see 2.

    Second. JacORB its config files are not OS specific - there is a mix of both Linux and Windows style. Don't rely on that.

    Your call to ns will call the jaco script in JacORBs bin directory. Activate the verbosity stuff at the end of the file, then start ns again and see which jre and jacorb.home are really used. Look for configs. Remove ALL other configs you do not need.

    Retry.