- 論壇徽章:
- 0
|
我部署好了項目后,寫好客戶端后運行test
Properties props = new Properties();
props.setProperty("jndi.factory","com.sun.jndi.cosnaming.CNCtxFactory");
props.setProperty("org.omg.CORBA.ORBInitialHost","localhost");
props.setProperty("org.omg.CORBA.ORBInitialPort","3700");
Context ctx = new InitialContext(props);
HelloRemote hr = (HelloRemote) ctx.lookup(HelloRemote.class.getName());
System.out.println(hr.getClass().getName());
System.out.println(hr.sayHello("zbs"));
但它在lookup這句代碼上報錯,
Exception in thread "main" javax.naming.CommunicationException: Can't find SerialContextProvider [Root exception is org.omg.CORBA.DATA_CONVERSION: ----------BEGIN server-side stack trace----------
我想了下,可能出現(xiàn)的地方應該是props.setProperty("org.omg.CORBA.ORBInitialPort","3700");
我以為是我機子上的orb port不是3700,所以出錯。
于是我查了domain里的配置文件,發(fā)現(xiàn)
<orb max-connections="1024" message-fragment-size="1024" use-thread-pool-ids="thread-pool-1"/>
<iiop-listener address="0.0.0.0" enabled="true" id="orb-listener-1" port="3700" security-enabled="false"/>
的確是3700啊,但為什么就報錯呢? |
|