- 论坛徽章:
- 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----------
我想了下,可能出现的地方应该是props.setProperty("org.omg.CORBA.ORBInitialPort","3700");
我以为是我机子上的orb port不是3700,所以出错。
于是我查了domain里的配置文件,发现
<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啊,但为什么就报错呢? |
|