문제

I'm new to CORBA and JacORB. I'm struggling with my first Hello World app using CORBA with JacORB.

This is the newest error I got:

Nov 04, 2013 9:52:19 AM com.sun.corba.se.impl.transport.SocketOrChannelConnectionIm <init>
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT;      hostname: localhost; port: 7070"
org.omg.CORBA.COMM_FAILURE:   vmcid: SUN  minor code: 201  completed: No

This is my server causes to that error:

    Properties props = new Properties();  
    props.put("org.omg.CORBA.ORBInitialPort","7070");
    props.put("org.omg.CORBA.ORBInitialHost","localhost");
    ORB orb = ORB.init(args, props);
    try {
        //
        POA poa = POAHelper.narrow(orb
                .resolve_initial_references("RootPOA"));
        poa.the_POAManager().activate();

        // Servant
        HelloVnImpl hello = new HelloVnImpl();
        // get servant reference
        Object o = poa.servant_to_reference(hello);
        HelloVn hVnRef = HelloVnHelper.narrow(o);

        // Get root naming context
        Object objRef = orb.resolve_initial_references("NameService");//Error
        NamingContextExt ncRef = NamingContextExtHelper.narrow(objRef);

Look around on the internet, the issue is apparently my nameservice, but I think I start it.

C:\Users\Paul>ns -ORBInitRef.NameService=corbaloc::localhost:7070/NameService
Nov 04, 2013 9:38:25 AM org.jacorb.config.JacORBConfiguration <init>
WARNING: no properties found for configuration jacorb
Nov 04, 2013 9:38:25 AM org.jacorb.orb.ORBSingleton <init>
INFO: created ORBSingleton
Nov 04, 2013 9:38:27 AM org.jacorb.orb.giop.CodeSet getTCSDefault
WARNING: Warning - unknown codeset (Cp1252) - defaulting to ISO-8859-1
Nov 04, 2013 9:38:27 AM org.jacorb.naming.NameServer main
INFO: NS up
Nov 04, 2013 9:38:27 AM org.jacorb.orb.ORB run
INFO: ORB run

Now, I have no idea to do next. Please give me an advice. Thank you. :)

UPDATE:

This line code give me a null value:

System.out.println(System.getProperty("org.omg.CORBA.ORBClass"));

What does it mean?. Does it tell me that there is something wrong with my nameserver?. Hope to see your advice. Thanks

도움이 되었습니까?

해결책

There are a couple of problems with the way that you setup your server and the Naming Service (NS):

1) The two properties (org.omg.CORBA.ORBInitialPort and org.omg.CORBA.ORBInitialHost) that you set in the server code are not JacORB properties. Assuming that you want your server to listen for requests on port 7070,then you want to set the "OAAddress" property like this:

props.put("OAAdress", "iiop://localhost:7070");

2) The option -ORBInitRef.NameService=corbaloc::localhost:XXX/NameService should be for the server to locate the NS and is not the NS. Please note that "XXX" is the listen port of the NS and is should not be "7070".

I would recommend that you take a look at the hello demo which includes both a working server and client and they are much simpler.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top