I would like to init my ORB from property file (normally I init it like this, while running my examples: ./app -ORBInitRef NameService=corbaloc::localhost:2809/NameService
)
I wrote a simple code:
private static String[] readConfigFile() { Properties prop = new Properties(); String arg[] = new String[1]; try { prop.load(new FileInputStream("config.properties")); } catch (IOException ex) {} arg[0] = prop.getProperty("ORBInitRef"); return arg; }
and then tried to init my orb:
clientsORB = org.omg.CORBA.ORB.init(readConfigFile(), null);
but there are some errors:
2012-11-01 12:15:36 com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl <init> WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: 127.0.1.1; port: 900" org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2172) at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2193) at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:223) at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:236) at com.sun.corba.se.impl.transport.SocketOrChannelContactInfoImpl.createConnection(SocketOrChannelContactInfoImpl.java:119) at com.sun.corba.se.impl.protocol.CorbaClientRequestDispatcherImpl.beginRequest(CorbaClientRequestDispatcherImpl.java:168) at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:136) at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.invoke(BootstrapResolverImpl.java:99) at com.sun.corba.se.impl.resolver.BootstrapResolverImpl.resolve(BootstrapResolverImpl.java:132) at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:47) at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:47) at com.sun.corba.se.impl.resolver.CompositeResolverImpl.resolve(CompositeResolverImpl.java:47) at com.sun.corba.se.impl.orb.ORBImpl.resolve_initial_references(ORBImpl.java:1174) at ClientConnection.connect(ClientConnection.java:68) at Client.main(Client.java:303) Caused by: java.net.ConnectException: Connection refused at sun.nio.ch.Net.connect(Native Method) at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:525) at java.nio.channels.SocketChannel.open(SocketChannel.java:164) at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket(DefaultSocketFactoryImpl.java:78) at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:206) ... 12 more
My config.properties file:
ORBInitRef NameService=corbaloc::localhost:2809/NameService
What I did wrong? When I init my ORB normally, everything is great, so its not the code issue, its definitely problem with initialization from file.