users@glassfish.java.net

EJB to Remote EJB invocation across machines hanging

From: Joe Bradley <gjoelbradley_at_netscape.net>
Date: Mon, 16 Nov 2009 08:17:10 -0500

We need to make a call from an EJB to another EJB deployed in a
different app on a different machine. We are able to get a remote
reference just fine, but when making the invocation it hangs. The
request finally times out after 30 minutes. If we move the exact same
calling code from an EJB to a servlet (in the same app), the call works
fine.

We are getting the reference using code like the following:

        Properties props = new Properties();
    props.setProperty("org.omg.CORBA.ORBInitialHost", host);
    props.setProperty("org.omg.CORBA.ORBInitialPort", port);
    props.setProperty("java.naming.factory.url.pkgs",
"com.sun.enterprise.naming");
    props.setProperty("java.naming.factory.state",
"com.sun.corba.ee.impl.presentation.rmi.JNDIStateFactoryImpl");
    props.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.enterprise.naming.SerialInitContextFactory");

    InitialContext ctx = new InitialContext(props);
    String jndiName = com.fd.TargetRemote.class.getName();
    TargetRemote ervice = (TargetRemote)ctx.lookup(jndiName);
    ctx.close();

We have also tried getting the reference by injecting it and using an
<ejb-ref> element in the calling EJB's deployment descriptor as
described in the EJB FAQ
<https://glassfish.dev.java.net/javaee5/ejb/EJB_FAQ.html#cross-appserverremoteref>.
In both cases, we can get the reference just fine, but any invocation to
the bean hangs.

If we deploy both of the enterprise apps on the same machine, even if
they are different domains, it works fine. It can't be firewall related
as it works from a servlet in the same app just fine. We are using SGES
v2.1 patch 5 but have also tried v2.1 (no patches) with the same result.

A thread dump of the calling thread when hung is shown below. Any ideas?

Joe


"p: thread-pool-1; w: 5" daemon prio=6 tid=0x444d1c00 nid=0x156c waiting
on condition [0x4511e000]
   java.lang.Thread.State: TIMED_WAITING (parking)
    at sun.misc.Unsafe.park(Native Method)
    - parking to wait for <0x3428c5d8> (a
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject)
    at
java.util.concurrent.locks.LockSupport.parkNanos(LockSupport.java:198)
    at
java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awaitNanos(AbstractQueuedSynchronizer.java:1963)
    at
com.sun.corba.ee.impl.transport.CorbaResponseWaitingRoomImpl.waitForResponse(CorbaResponseWaitingRoomImpl.java:184)
    at
com.sun.corba.ee.impl.transport.SocketOrChannelConnectionImpl.waitForResponse(SocketOrChannelConnectionImpl.java:1196)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.waitForResponse(CorbaMessageMediatorImpl.java:291)
    at
com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete1(CorbaClientRequestDispatcherImpl.java:389)
    at
com.sun.corba.ee.impl.protocol.CorbaClientRequestDispatcherImpl.marshalingComplete(CorbaClientRequestDispatcherImpl.java:357)
    at
com.sun.corba.ee.impl.protocol.CorbaClientDelegateImpl.invoke(CorbaClientDelegateImpl.java:222)
    at
com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.privateInvoke(StubInvocationHandlerImpl.java:192)
    at
com.sun.corba.ee.impl.presentation.rmi.StubInvocationHandlerImpl.invoke(StubInvocationHandlerImpl.java:152)
    at
com.sun.corba.ee.impl.presentation.rmi.bcel.BCELStubBase.invoke(BCELStubBase.java:225)
    at
com.fd.__TargetRemote_Remote_DynamicStub.getDateRemote(com/fd/__TargetRemote_Remote_DynamicStub.java)
    at
com.fd._TargetRemote_Wrapper.getDateRemote(com/fd/_TargetRemote_Wrapper.java)
    at com.fd.EEClientBean.getDate(EEClientBean.java:29)
    at com.fd.EEClientBean.getDateRemote(EEClientBean.java:39)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
com.sun.enterprise.security.application.EJBSecurityManager.runMethod(EJBSecurityManager.java:1011)
    at
com.sun.enterprise.security.SecurityUtil.invoke(SecurityUtil.java:175)
    at
com.sun.ejb.containers.BaseContainer.invokeTargetBeanMethod(BaseContainer.java:2928)
    at
com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:4019)
    at
com.sun.ejb.containers.EJBObjectInvocationHandler.invoke(EJBObjectInvocationHandler.java:203)
    at
com.sun.ejb.containers.EJBObjectInvocationHandlerDelegate.invoke(EJBObjectInvocationHandlerDelegate.java:117)
    at $Proxy28.getDateRemote(Unknown Source)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at
com.sun.corba.ee.impl.presentation.rmi.ReflectiveTie._invoke(ReflectiveTie.java:154)
    at
com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatchToServant(CorbaServerRequestDispatcherImpl.java:687)
    at
com.sun.corba.ee.impl.protocol.CorbaServerRequestDispatcherImpl.dispatch(CorbaServerRequestDispatcherImpl.java:227)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequestRequest(CorbaMessageMediatorImpl.java:1846)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:1706)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleInput(CorbaMessageMediatorImpl.java:1088)
    at
com.sun.corba.ee.impl.protocol.giopmsgheaders.RequestMessage_1_2.callback(RequestMessage_1_2.java:223)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.handleRequest(CorbaMessageMediatorImpl.java:806)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.dispatch(CorbaMessageMediatorImpl.java:563)
    at
com.sun.corba.ee.impl.protocol.CorbaMessageMediatorImpl.doWork(CorbaMessageMediatorImpl.java:2567)
    at
com.sun.corba.ee.impl.orbutil.threadpool.ThreadPoolImpl$WorkerThread.run(ThreadPoolImpl.java:555)