Reputation: 1
I'm trying to make a remote EJB 3 call from a thin client to WebSphere Liberty 20.0.0.10 (JDK 8). The client is not running in an EJB container. I googled this page and tried to follow the instructions: https://www.ibm.com/support/knowledgecenter/SSD28V_liberty/com.ibm.websphere.wlp.core.doc/ae/twlp_ejb_remote.html
According to the server log, the EJB is bound to this address:
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 is the name of the application, and there's only a single war module which contains the EJBs)
I can call it locally without problems. I try to look it up remotely with this string:
corbaname::localhost:12809#ejb/global/codeserver/DW_CS_LoggingRemoteServicesBean!fi\.datawell\.cs\.ejb\.logging\.boundary\.DW_CS_LoggingServices
(The IIOP service is in port 12809)
Somehow I get this error in the log, although it doesn't cause an exception in the application.
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
This address seems to be correct, because if I change the port, I get "connection refused" and if I change the bean name, I get NameNotFoundException.
I get an instance of com.sun.corba.se.impl.corba.CORBAObjectImpl
as response, but when I use PortableRemoteObject.narrow()
method, I get null without any exception. Now I wonder what I'm doing wrong. Do I need some kind of EJB stubs although this is EJB 3 application?
Addendum: Actually we are doing a migration from WebSphere traditional to WebSphere Liberty and I thought we could get rid of running createEJBStubs, because it is slow (using maven plugin) and requires WAS traditional installation (which isn't available for Mac). Now I tried with createEJBStubs and got a bit further. First I had to add com.ibm.websphere.javaee.ejb.3.2_1.0.45.jar
to classpath. After that things get a bit further. I can fetch the EJB, but the first attempt to use it fails with a familiar exception:
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
Now I don't know what to try next. The same exception still appears on log whenever the EJB is retrieved, but in that situation it seems to be silently consumed. I wonder why there is port 0 in the exception...
Upvotes: 0
Views: 1282
Reputation: 1073
WebSphere Liberty does not provide an EJB thin client, however, you may use the WebSphere traditional thin client to access a WebSphere Liberty server:
For a thin client, all EJB remote interfaces require a Stub, whether using the 2.x or 3.x APIs. For EJB 2.x, you could use RMIC
with the -iiop
option. For EJB 3.x (that is being used here), you need to use the createEJBStubs
command provided by WebSphere traditional :
createEJBStubs
may also be used for EJB 2.x remote interfaces as well.
Note that a Stub is generated for you in a WebSphere server process that has the ejbRemote-3.2
feature enabled or in an application client process (i.e. thick client). More information about the application client is here:
Since you are receiving a CORBAObjectImpl
, and the narrow does not work, it would seem that at least part of the problem is the lack of Stub classes.
Upvotes: 1