我写了一个远程无状态的bean 用websphere部署 但是在客户端调用的时候出错了
以下是客户端调用程序
package com.chncloud.steven.test;import java.util.Properties;import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;import com.chncloud.steven.bean.HelloWorldBeanRemote;public class TestRemote {
public static InitialContext TestCall() {
InitialContext ic = null;
try {
Properties props = new Properties();
props.put(Context.PROVIDER_URL, "iiop://localhost:2809/");
props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(Context.SECURITY_PRINCIPAL, "admin");
props.put(Context.SECURITY_CREDENTIALS, "admin");
ic = new InitialContext(props);
System.out.println("ko2");
} catch (Exception e) {
e.printStackTrace();
}
return ic; }
public static void main(String[] args)
{
InitialContext cxt = TestCall();
System.out.println("ko1");
try {
HelloWorldBeanRemote bean = (HelloWorldBeanRemote)cxt.lookup("HelloWorldBean");
System.out.println(bean.sayHelloWorld());
} catch (NamingException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
但是每次调用都出现如下错误
ko2
ko1
javax.naming.NamingException: Error getting WsnNameService properties [Root exception is org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible vmcid: IBM minor code: E07 completed: No]
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1439)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:946)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:865)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:545)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:123)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:798)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:164)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.chncloud.steven.test.TestRemote.main(TestRemote.java:41)
Caused by: org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible vmcid: IBM minor code: E07 completed: No
at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1250)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1321)
at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1146)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1287)
at com.ibm.rmi.corba.ClientDelegate.request(ClientDelegate.java:1853)
at com.ibm.CORBA.iiop.ClientDelegate.request(ClientDelegate.java:1243)
at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:458)
at com.ibm.WsnBootstrap._WsnNameServiceStub.getProperties(_WsnNameServiceStub.java:38)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1436)
... 9 more
请大家帮帮忙 看看是什么问题
以下是客户端调用程序
package com.chncloud.steven.test;import java.util.Properties;import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;import com.chncloud.steven.bean.HelloWorldBeanRemote;public class TestRemote {
public static InitialContext TestCall() {
InitialContext ic = null;
try {
Properties props = new Properties();
props.put(Context.PROVIDER_URL, "iiop://localhost:2809/");
props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.ibm.websphere.naming.WsnInitialContextFactory");
props.put(Context.SECURITY_PRINCIPAL, "admin");
props.put(Context.SECURITY_CREDENTIALS, "admin");
ic = new InitialContext(props);
System.out.println("ko2");
} catch (Exception e) {
e.printStackTrace();
}
return ic; }
public static void main(String[] args)
{
InitialContext cxt = TestCall();
System.out.println("ko1");
try {
HelloWorldBeanRemote bean = (HelloWorldBeanRemote)cxt.lookup("HelloWorldBean");
System.out.println(bean.sayHelloWorld());
} catch (NamingException e) {
// TODO 自动生成 catch 块
e.printStackTrace();
}
}
}
但是每次调用都出现如下错误
ko2
ko1
javax.naming.NamingException: Error getting WsnNameService properties [Root exception is org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible vmcid: IBM minor code: E07 completed: No]
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1439)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootContextFromServer(WsnInitCtxFactory.java:946)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getRootJndiContext(WsnInitCtxFactory.java:865)
at com.ibm.ws.naming.util.WsnInitCtxFactory.getInitialContextInternal(WsnInitCtxFactory.java:545)
at com.ibm.ws.naming.util.WsnInitCtx.getContext(WsnInitCtx.java:123)
at com.ibm.ws.naming.util.WsnInitCtx.getContextIfNull(WsnInitCtx.java:798)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:164)
at com.ibm.ws.naming.util.WsnInitCtx.lookup(WsnInitCtx.java:179)
at javax.naming.InitialContext.lookup(Unknown Source)
at com.chncloud.steven.test.TestRemote.main(TestRemote.java:41)
Caused by: org.omg.CORBA.TRANSIENT: initial and forwarded IOR inaccessible vmcid: IBM minor code: E07 completed: No
at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1250)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1321)
at com.ibm.rmi.corba.ClientDelegate.createRequest(ClientDelegate.java:1146)
at com.ibm.CORBA.iiop.ClientDelegate.createRequest(ClientDelegate.java:1287)
at com.ibm.rmi.corba.ClientDelegate.request(ClientDelegate.java:1853)
at com.ibm.CORBA.iiop.ClientDelegate.request(ClientDelegate.java:1243)
at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:458)
at com.ibm.WsnBootstrap._WsnNameServiceStub.getProperties(_WsnNameServiceStub.java:38)
at com.ibm.ws.naming.util.WsnInitCtxFactory.mergeWsnNSProperties(WsnInitCtxFactory.java:1436)
... 9 more
请大家帮帮忙 看看是什么问题
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货