Java IDL / CORBA

Status
Nicht offen für weitere Antworten.

thebootstrap

Mitglied
hi all

my classpath is correctly set and the "HelloWorld" IDL/CORBA example makes another problem:

when running the server, the instruction

Code:
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);

in the server code waits a bit and then the following error occurs

06.07.2005 10:31:45 com.sun.corba.se.impl.transport.SocketOrChannelConnectionImp
l <init>
WARNUNG: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR
_TEXT; hostname: 192.168.1.104; port: 1049"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(Unknown Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(Unkn own Source)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(Unkn own Source)
at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection (Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(Un known Source)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(Unknown Source)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.is_a(Unknown Source)
at org.omg.CORBA.portable.ObjectImpl._is_a(Unknown Source)
at org.omg.CosNaming.NamingContextExtHelper.narrow(Unknown Source)
at HelloServer.main(HelloServer.java:65)
Caused by: java.net.ConnectException: Connection timed out: connect
at sun.nio.ch.Net.connect(Native Method)
at sun.nio.ch.SocketChannelImpl.connect(Unknown Source)
at java.nio.channels.SocketChannel.open(Unknown Source)
at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket
(Unknown Source)
... 9 more


is somebody able to help me with this one? thanks alot in advance!

greetings!
 
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No

completed: no means an excpetion occured prior an object implementation was invoked
minor code 201 means connection failure

so I assume either your name service is not running or not connectable for any reason (e.g using a non matching ior)
 
yes you are right i think, but the problem is: i started orbd as written in the tutorial.. 🙁 so i don't know what steps to take now..
 
could you post how you start the orbd, the server and the client (orbinitialreference, orbinitialport, orbinitialhost)
 
by the way, here's my server code. not that i commented out some lines below -> like this, there is no exception and all goes well (when i uncomment the line

Code:
NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);

i get the problem again), and of course, those lines are necessary 🙂

thanks for your help, all of you!

Code:
// Copyright and License 
import HelloApp.*;
import org.omg.CosNaming.*;
import org.omg.CosNaming.NamingContextPackage.*;
import org.omg.CORBA.*;
import org.omg.PortableServer.*;
import org.omg.PortableServer.POA;
import java.util.*;

import java.util.Properties;

class HelloImpl extends HelloApp.HelloPOA{
  private ORB orb;

  public void setORB(ORB orb_val){
    orb = orb_val;
  }
  
  public String sayHello(){
    return "\nHello world !!\n";
  }
  
  public void shutdown(){
    orb.shutdown(false);
  }
}

public class HelloServer{

  public static void main(String args[]){
    try{
      // create and initialize the ORB
	System.out.println("server: create and initialize the ORB");
        Properties props = new Properties();
        props.put("org.omg.CORBA.ORBInitialPort", "5510");
        props.put("org.omg.CORBA.ORBInitialHost", "127.0.0.1");
      ORB orb = ORB.init(args, props);

      // Get reference to rootpoa & activate the POAManager
	System.out.println("server: Get reference to rootpoa & activate the POAManager");
      POA rootpoa = POAHelper.narrow(orb.resolve_initial_references("RootPOA"));
      rootpoa.the_POAManager().activate();

      // create servant and register it with the ORB
	System.out.println("server: create servant and register it with the ORB");
      HelloImpl helloImpl = new HelloImpl();
      helloImpl.setORB(orb); 

      // create a tie, with servant being the delegate.
	System.out.println("server: create a tie, with servant being the delegate.");
      HelloApp.HelloPOATie tie = new HelloApp.HelloPOATie(helloImpl, rootpoa);

      // obtain the objectRef for the tie
      // this step also implicitly activates the 
      // the object
	System.out.println("server: obtain the objectRef for the tie");
      HelloApp.Hello href = tie._this(orb);
	    
      // get the root naming context
	System.out.println("server: get the root naming context");
      org.omg.CORBA.Object objRef = orb.resolve_initial_references("NameService");
      
      // Use NamingContextExt which is part of the Interoperable
      // Naming Service specification.
//	System.out.println("server: Use NamingContextExt which is part of the Interoperable Naming Service specification.");
//      NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);

      // bind the Object Reference in Naming
//	System.out.println("server: bind the Object Reference in Naming");
//      String name = "Hello";
//      NameComponent path[] = ncRef.to_name( name );
//      ncRef.rebind(path, href);

      System.out.println("HelloServer ready and waiting ...");

      // wait for invocations from clients
//      orb.run();
      } 
      
    catch (Exception e){
      System.err.println("ERROR: " + e);
      e.printStackTrace(System.out);
    }
    
    System.out.println("HelloServer Exiting ...");
	
  }
}
[/code]
 
i start the orbd like this:

Code:
orbd -ORBInitialPort 5510 -ORBInitialHost 127.0.0.1

and for the moment, i don't even try to run a client 🙂 server first.

i run the server like this (because i introduced properties in the server's code

Code:
java HelloServer

but even

Code:
java HelloServer -ORBInitialPort 5510 -ORBInitialHost 127.0.0.1

does not work.. 🙁
 
about the orbd, don't you use start (windows) or & (unix)? or do you have a dedicated console for orbd

well, I think the property org.omg.CORBA.ORBInitialPort and org.omg.CORBA.ORBInitialHost are not known. the java example uses them without qualification. also, this would explain why you say localhost:5... and the nameservice is expected at 192...... : 1049
 
there is the -port option which causes the error message you sent me to change to the port 5510, yes. but still, the whole thing does not work :/
and then -ORBInitialPort seems to exist and to be necessary if one wants to change the port
 
well i tried the servertool and the example using it - did not work.

so it must be this orbd which causes trouble but well... starting it like in the example seems to work because this tool does not return anything to me, when i start it... it simply starts with no report, even when i start it like orbd -Shit 1000, it seems to run. so its difficult to find the mistake 🙁
 
I am a Sw develper which interests in corba, which first time I met in faculty studies, when I implement a c++ corba application.
Now I would like to try it in java, where I go some success, but still not in a manner I would like to .
The point is that I would like to implement a server and a client using a method, so that client may connect to server without being a ORB daemon needed...
One sugested me to use IOR files, but I would like to perform a conection without manipulating files, by knowing the interface , IP Address and port, how should I proceed ?
Some time ago in a c++ corba I used: by client launching ( for example):

-ORBIIOPAddr: inet:192.168.2.2:1400

And it conects to server direclty without starting a daemon as I remember ...
In the client code sequence I used an ORB.bind(...) method call and a narraw call .
Which should be the java functions for this approach ?

victor.cuteanu@siemens.com

Thank You
Best Regards
Victor
 
Status
Nicht offen für weitere Antworten.

Zurück
Oben