ejb lookup takes > 90 seconds to timeout? namingServer with
varunrupela Oct 14, 2004 7:00 PMHi:
Here's how I ran into this issue:
- let one ejb lookup succeed to a remote server running jboss.
- take the remote machine off the network (pulled its network cable out).
- do another ejb lookup.
- It takes about 90 seconds for the lookup to timeout.
I debugged into some of the org.jnp.interfaces.NamingContext class. Here's what I think happened?
- NamingServers are being cached.
- The TimedSocketFactory is used to create a socketConnection only when the namingServer is not found in the cache. Meaning that "jnp.soTimeout" and "jnp.soTimeout" properties are used only in this case.
- So when I did the second lookup, the namingServer was found in the cache and lookup was done. That leads to the about 2 min timeout.
- I wanted to check if I was correct?
- Also, is there a way to set the timeout on the naming.lookup() call in the org.jnp.interfaces.NamingContext.lookup() method?
- Is there another option?
2 stack traces are attached below:
First: shows the 90 second timeout.
Second: shows the much quicker timeout, that uses TimedSocketFactory.
Thanks a lot.
Varun.
*************************************
Stack Trace 1: Shows 90 second timeout
Caused by: javax.naming.CommunicationException [Root exception is java.rmi.ConnectException: Connection refused to host: 172.16.5.92; nested exception is:
java.net.ConnectException: Connection timed out: connect]
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:647)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.enttek.framework.util.plugin.HomeObjectCreater.create(HomeObjectCreater.java:32)
at com.enttek.framework.util.plugin.RemoteEjbFactory.createHomeObject(RemoteEjbFactory.java:44)
at com.enttek.framework.util.plugin.RemoteEjbFactory.createService(RemoteEjbFactory.java:27)
... 11 more
Caused by: java.rmi.ConnectException: Connection refused to host: 172.16.5.92; nested exception is:
java.net.ConnectException: Connection timed out: connect
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:567)
at sun.rmi.transport.tcp.TCPChannel.createConnection(TCPChannel.java:185)
at sun.rmi.transport.tcp.TCPChannel.newConnection(TCPChannel.java:171)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:101)
at org.jnp.server.NamingServer_Stub.lookup(Unknown Source)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:528)
... 16 more
Caused by: java.net.ConnectException: Connection timed out: connect
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:305)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:171)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:158)
at java.net.Socket.connect(Socket.java:452)
at java.net.Socket.connect(Socket.java:402)
at java.net.Socket.(Socket.java:309)
at java.net.Socket.(Socket.java:124)
at sun.rmi.transport.proxy.RMIDirectSocketFactory.createSocket(RMIDirectSocketFactory.java:22)
at sun.rmi.transport.proxy.RMIMasterSocketFactory.createSocket(RMIMasterSocketFactory.java:128)
at sun.rmi.transport.tcp.TCPEndpoint.newSocket(TCPEndpoint.java:562)
... 21 more
***************************************************
Stack Trace 2: Shows the quicker timeout.
2004-10-14 14:16:51,455 [TimerTask: Connection Monitor] WARN NamingContext - Failed to connect to backofficetest:1099
javax.naming.CommunicationException: Failed to connect to server backofficetest:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server backofficetest:1099 [Root exception is java.net.ConnectException: Connect attempt timed out]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:215)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1183)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:514)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:507)
at javax.naming.InitialContext.lookup(InitialContext.java:347)
at com.enttek.framework.util.plugin.HomeObjectCreater.create(HomeObjectCreater.java:32)
at com.enttek.framework.util.plugin.RemoteEjbFactory.createHomeObject(RemoteEjbFactory.java:44)
at com.enttek.framework.util.plugin.RemoteEjbFactory.createService(RemoteEjbFactory.java:27)
at com.enttek.framework.util.plugin.EjbFactoryProxy.createService(EjbFactoryProxy.java:20)
at com.enttek.framework.util.plugin.ServiceLocator.createService(ServiceLocator.java:63)
at com.enttek.framework.util.plugin.ServiceLocator.getServiceForEndpoint(ServiceLocator.java:59)
at com.enttek.framework.util.plugin.ServiceLocator.getService(ServiceLocator.java:42)
at com.enttek.framework.util.plugin.ServiceFactory.getService(ServiceFactory.java:170)
at com.enttek.salesapp.ConnectionMonitor.getBOHealthMonitor(ConnectionMonitor.java:73)
at com.enttek.salesapp.ConnectionMonitor.checkBOHealth(ConnectionMonitor.java:55)
at com.enttek.salesapp.ConnectionMonitor.access$000(ConnectionMonitor.java:20)
at com.enttek.salesapp.ConnectionMonitor$1.run(ConnectionMonitor.java:47)
at com.enttek.framework.util.TimerFactoryImpl$NamedTimerTask.run(TimerFactoryImpl.java:21)
at java.util.TimerThread.mainLoop(Timer.java:432)
at java.util.TimerThread.run(Timer.java:382)
Caused by: javax.naming.ServiceUnavailableException: Failed to connect to server backofficetest:1099 [Root exception is java.net.ConnectException: Connect attempt timed out]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:190)
... 19 more
Caused by: java.net.ConnectException: Connect attempt timed out
at org.jnp.interfaces.TimedSocketFactory$ConnectThread.createSocket(TimedSocketFactory.java:139)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:82)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:71)
at org.jnp.interfaces.TimedSocketFactory.createSocket(TimedSocketFactory.java:62)
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:186)
... 19 more