Jakarta ee websphere远程ejb调用CORBA.OBJECT\u NOT\u EXIST LocateReply.UNKNOWN\u对象次要代码:C01
我在同一台机器上有两个本地WebSphere7应用程序服务器(两个配置文件)。只是一个默认安装,没有自定义配置。其中一个公开了一个部署为EJB3会话bean的服务,其名称为ejb/edu/test/ejbfacadejndi 我编写了一个简单的JUnit集成测试,远程调用一个方法:Jakarta ee websphere远程ejb调用CORBA.OBJECT\u NOT\u EXIST LocateReply.UNKNOWN\u对象次要代码:C01,jakarta-ee,ejb,websphere,Jakarta Ee,Ejb,Websphere,我在同一台机器上有两个本地WebSphere7应用程序服务器(两个配置文件)。只是一个默认安装,没有自定义配置。其中一个公开了一个部署为EJB3会话bean的服务,其名称为ejb/edu/test/ejbfacadejndi 我编写了一个简单的JUnit集成测试,远程调用一个方法: @Test public void testCall() throws Exception { Hashtable props = new Hashtable(); props.put(Context
@Test
public void testCall() throws Exception {
Hashtable props = new Hashtable();
props.put(Context.PROVIDER_URL, "corbaloc:iiop:localhost:2811");
props.put(Context.INITIAL_CONTEXT_FACTORY, "com.ibm.websphere.naming.WsnInitialContextFactory");
props.put("org.omg.CORBA.ORBClass", "com.ibm.CORBA.iiop.ORB");
InitialContext initialContext = new InitialContext(props);
Object obj = initialContext.lookup("cell/nodes/myNode03/servers/server1/ejb/edu/test/EjbFacade");
EjbFacade facade = (EjbFacade) PortableRemoteObject.narrow(obj, EjbFacade.class);
facade.doSomething();
}
这很好用强>
然后我有一个带有EJB引用的web应用程序:
ibm-web-bnd.xmi
<ejbRefBindings xmi:id="EjbRefBinding_1386431681401" jndiName="ejb/edu/test/EjbFacade">
<bindingEjbRef href="WEB-INF/web.xml#EjbRefBinding_EjbFacade"/>
</ejbRefBindings>
我应该在WAS控制台中配置什么JNDI名称?为什么相同的代码在JUnit下工作,但在servlet中失败了?好的,设法让它工作 问题是WebSphereInstaller默认创建了两个同名的服务器:server1
- myNode01Cell/myNode01/server1
- myNode02Cell/myNode02/server1
而造成这种问题的原因是一个内在因素。重命名一台服务器修复了ejb调用。您需要uniqueServerName选项。请参阅信息中心主题中的“使用在同一主机上运行的两台同名服务器进行互操作”部分。还查看了websphere文档:错误描述为“确保请求的远程对象驻留在指定的服务器中,并且远程引用是最新的”。有人能详细说明一下“远程引用是最新的”是什么意思吗?我要求更新这个技术说明,现在它还提到了uniqueServerName解决方案。谢谢你指出这个遗漏。
<ejb-ref id="EjbRefBinding_EjbFacade">
<ejb-ref-name>ejb/edu/test/EjbFacade</ejb-ref-name>
<ejb-ref-type>Session</ejb-ref-type>
<home/>
<remote>edu.test.EjbFacade</remote>
</ejb-ref>
Caused by: javax.naming.ServiceUnavailableException: A communication failure
occurred while attempting to obtain an initial context with the provider URL:
"corbaloc:iiop:localhost:2811/cell/nodes/myNode03/servers/server1/ejb/edu/test/EjbFacade".
Make sure that any bootstrap address information in the URL is correct and that the target
name server is running. A bootstrap address with no port specification defaults to port 2809.
Possible causes other than an incorrect bootstrap address or unavailable name server
include the network environment and workstation network configuration.
[Root exception is org.omg.CORBA.OBJECT_NOT_EXIST: LocateRequest 6 received
LocateReply.UNKNOWN_OBJECT vmcid: IBM minor code: C01 completed: No]