【发布时间】:2020-10-13 12:11:37
【问题描述】:
我正在尝试从瘦客户端向 WebSphere Liberty 20.0.0.10 (JDK 8) 进行远程 EJB 3 调用。客户端未在 EJB 容器中运行。我用谷歌搜索了这个页面并尝试按照说明进行操作: https://www.ibm.com/support/knowledgecenter/SSD28V_liberty/com.ibm.websphere.wlp.core.doc/ae/twlp_ejb_remote.html
根据服务器日志,EJB绑定到这个地址:
CNTR0167I: The server is binding the fi.datawell.cs.ejb.logging.boundary.DW_CS_LoggingServices interface of the DW_CS_LoggingRemoteServicesBean enterprise bean in the codeserver.war module of the codeserver application. The binding location is: java:global/codeserver/DW_CS_LoggingRemoteServicesBean!fi.datawell.cs.ejb.logging.boundary.DW_CS_LoggingServices
(codeserver 是应用程序的名称,只有一个包含 EJB 的 war 模块)
我可以毫无问题地在本地调用它。我尝试用这个字符串远程查找它:
corbaname::localhost:12809#ejb/global/codeserver/DW_CS_LoggingRemoteServicesBean!fi\.datawell\.cs\.ejb\.logging\.boundary\.DW_CS_LoggingServices
(IIOP 服务在 12809 端口)
不知何故,我在日志中收到了这个错误,尽管它不会导致应用程序出现异常。
WARNING: "IOP00410201: (COMM_FAILURE) Connection failure: socketType: IIOP_CLEAR_TEXT; hostname: localhost; port: 0"
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2200)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2221)
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:187)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:137)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.is_a(CorbaClientDelegateImpl.java:229)
at org.omg.CORBA.portable.ObjectImpl._is_a(ObjectImpl.java:130)
at org.omg.CosNaming.NamingContextHelper.narrow(NamingContextHelper.java:69)
at com.sun.jndi.cosnaming.CNCtx.callResolve(CNCtx.java:504)
at com.sun.jndi.cosnaming.CNCtx.lookup(CNCtx.java:555)
at com.sun.jndi.toolkit.url.GenericURLContext.lookup(GenericURLContext.java:205)
at javax.naming.InitialContext.lookup(InitialContext.java:417)
at fi.datawell.cs.ejb.DW_CS_EjbFactory.lookupService(DW_CS_EjbFactory.java:91)
at fi.datawell.cs.ejb.DW_CS_EjbFactory.lookupLoggingRemoteServicesEJB(DW_CS_EjbFactory.java:284)
at fi.datawell.cs.application.clients.versionloader.DW_CS_VersionLoaderWorker.fetchClientServices(DW_CS_VersionLoaderWorker.java:983)
at fi.datawell.cs.application.clients.versionloader.DW_CS_VersionLoader.initialize(DW_CS_VersionLoader.java:114)
at fi.datawell.cs.application.clients.versionloader.DW_CS_VersionLoader.main(DW_CS_VersionLoader.java:252)
Caused by: java.net.BindException: Cannot assign requested address: connect
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:454)
at sun.nio.ch.Net.connect(Net.java:446)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
at java.nio.channels.SocketChannel.open(SocketChannel.java:189)
at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket(DefaultSocketFactoryImpl.java:95)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:207)
... 16 more
这个地址似乎是正确的,因为如果我更改端口,我会得到“连接被拒绝”,如果我更改 bean 名称,我会得到 NameNotFoundException。
我得到一个 com.sun.corba.se.impl.corba.CORBAObjectImpl 的实例作为响应,但是当我使用 PortableRemoteObject.narrow() 方法时,我得到 null 没有任何异常。现在我想知道我做错了什么。尽管这是 EJB 3 应用程序,我是否需要某种 EJB 存根?
附录:实际上我们正在从传统的 WebSphere 迁移到 WebSphere Liberty,我认为我们可以摆脱运行 createEJBStubs,因为它很慢(使用 maven 插件)并且需要传统的 WAS 安装(不适用于 Mac )。现在我尝试使用 createEJBStubs 并获得了更进一步的结果。首先我必须将com.ibm.websphere.javaee.ejb.3.2_1.0.45.jar 添加到类路径中。在那之后,事情变得更进一步了。我可以获取 EJB,但第一次尝试使用它失败并出现一个熟悉的异常:
javax.ejb.EJBException: nested exception is: java.rmi.MarshalException: CORBA COMM_FAILURE 1398079689 No; nested exception is:
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at fi.datawell.cs.ejb.logging.boundary._DW_CS_LoggingServices_Stub.log(_DW_CS_LoggingServices_Stub.java:1101)
at fi.datawell.cs.application.clients.core.DW_CS_BaseWorker.writeCodeServerLog(DW_CS_BaseWorker.java:66)
at fi.datawell.cs.application.clients.versionloader.DW_CS_VersionLoader.initialize(DW_CS_VersionLoader.java:120)
at fi.datawell.cs.application.clients.versionloader.DW_CS_VersionLoader.main(DW_CS_VersionLoader.java:252)
Caused by: java.rmi.MarshalException: CORBA COMM_FAILURE 1398079689 No; nested exception is:
org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.se.impl.javax.rmi.CORBA.Util.mapSystemException(Util.java:219)
at javax.rmi.CORBA.Util.mapSystemException(Util.java:95)
at fi.datawell.cs.ejb.logging.boundary._DW_CS_LoggingServices_Stub.log(_DW_CS_LoggingServices_Stub.java:1)
... 3 more
Caused by: org.omg.CORBA.COMM_FAILURE: vmcid: SUN minor code: 201 completed: No
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2200)
at com.sun.corba.se.impl.logging.ORBUtilSystemException.connectFailure(ORBUtilSystemException.java:2221)
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:187)
at com.sun.corba.se.impl.protocol.CorbaClientDelegateImpl.request(CorbaClientDelegateImpl.java:137)
at org.omg.CORBA.portable.ObjectImpl._request(ObjectImpl.java:449)
at fi.datawell.cs.ejb.logging.boundary._DW_CS_LoggingServices_Stub.log(_DW_CS_LoggingServices_Stub.java)
... 3 more
Caused by: java.net.BindException: Cannot assign requested address: connect
at sun.nio.ch.Net.connect0(Native Method)
at sun.nio.ch.Net.connect(Net.java:454)
at sun.nio.ch.Net.connect(Net.java:446)
at sun.nio.ch.SocketChannelImpl.connect(SocketChannelImpl.java:648)
at java.nio.channels.SocketChannel.open(SocketChannel.java:189)
at com.sun.corba.se.impl.transport.DefaultSocketFactoryImpl.createSocket(DefaultSocketFactoryImpl.java:95)
at com.sun.corba.se.impl.transport.SocketOrChannelConnectionImpl.<init>(SocketOrChannelConnectionImpl.java:207)
... 9 more
现在我不知道下一步该尝试什么。每当检索 EJB 时,日志中仍会出现相同的异常,但在这种情况下,它似乎被静默使用。我想知道为什么异常中有端口0...
【问题讨论】:
标签: java jakarta-ee websphere-liberty