Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
1.0k views
in Technique[技术] by (71.8m points)

java - Error when trying to connect to Jacorb naming service

I'm hoping to get some help with this weird problem. We're running the Jacorb name server and I have a simple client that I'm using to try to connect and do awesome CORBA voodoo. The name server is running, but when I try to start my java app, I get a "Connection failure" error (org.omg.CORBA.COMM_FAILURE, minor code 201, "caused by java.net.ConnectionException: Connection refused: connect").

Here's the weird part. The error reports that it's trying to connect using the default port 900, but I'm passing in an argument to try to override the port number of the name service to match the one being used by the name server. My java command is like this:

java -classpath . HelloClient -Djava.endorsed.dirs="bla bla bla" <br>
-Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB 
-Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton
-DORBInitRef.NameService=corbaloc::localhost:2809/StandardNS/NameServer-POA/_root

I also tried the parameters without the first capital D (I've seen it both ways and I don't know the difference).

Now, if I put in -ORBInitialPort 2809, then the client does appear to try to connect, but then I get a corba.OBJECT_NOT_EXIST error.

I could use any help or advice anyone has.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Connection Refused. This sounds like a firewall/program not running issue. try a telnet <machine> 2809. You should get a "Connected to " and not a refusal, if everything is running/enabled correctly.

I'm running on a UNIX client so the paths use UNIX style.

  1. jacORB installed properly ? e.g. get the nameservice entry from the orb.properties file (in ${JAVA_HOME}/jre/lib/ I use "ORBInitRef.NameService=corbaloc::localhost:2809/NameServer" as "NameServer" is used on the production name server and not the other string of "Standard...."

    The other changes in the properties files are setting the paths to UNIX style (i.e. e:NS_Ref -> /tmp/NS_Ref) jacorb.naming.ior_filename=/tmp/NS_Ref

1a. Setting the http:// in the properties file didn't seem to do anything in regards to resolving on the client side.

1b. NOTE: start ns with: ns -DOAPort=2809

Log will show: 2010-05-27 10:00:47.777 FINE Created socket listener on 0.0.0.0/0.0.0.0:2809 2010-05-27 10:00:47.777 FINE Using port 2809 Running: $ lsof | grep 2809 java 27529 jbsymolo 15u IPv6 693300 TCP *:2809 (LISTEN) $ lsof -Pnl +M -i6 COMMAND PID USER FD TYPE DEVICE SIZE NODE NAME Naming_Se 9678 1000 7u IPv6 45779 TCP *:51148 (LISTEN) java 27959 1000 15u IPv6 696092 TCP *:2809 (LISTEN)

Not Running: (shows nothing)

  1. ns when started will log where it reads the properties from and it shouldn't throw any errors. If it does your properties files have issues.

  2. VM arguments. The -D is used to set system properties. Any Java code can then access any property so defined via System.getProperty(). Even though I've also seen the "non-D" used, I've been using the D.

    -DORBInitRef.NameService=corbaloc::localhost:2809/NameService -Dorg.omg.CORBA.ORBClass=org.jacorb.orb.ORB -Dorg.omg.CORBA.ORBSingletonClass=org.jacorb.orb.ORBSingleton

When running the client in Eclipse, I see the following in the Console:

May 27, 2010 10:01:06 AM org.jacorb.config.JacORBConfiguration init
INFO: base configuration loaded from file /usr/lib/java/jdk1.6.0_18/jre/lib/orb.properties
...
2010-05-27 10:01:09.836 FINE Trying to connect to 127.0.0.1:2809 with timeout=90000.
2010-05-27 10:01:09.844 INFO Connected to 127.0.0.1:2809 from local port 45745
2010-05-27 10:01:09.846 FINE wrote 12 bytes to 127.0.0.1:2809
...

Skipping lots of other read/write traffic


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...