JNDI Connection Retry Limit

(I'm not sure if this post belongs in a different forum, but it's related to interacting with Glassfish from a client)

I've been continuing work on writing a stand-alone client to connect to my Glassfish server and access some EJBs. I forgot to start up the server before running the client this morning and it showed me an annoying problem: if the server can't be contacted by the JNDI API, I'm thrown into an infinite loop of runtime exceptions! I assume this is because the JNDI API insists on trying to reconnect indefinitely.

Is there a way to limit the number of retries JNDI does before giving up? I've Googled around, looked for java.naming.* JVM arguments and looked for CORBA JVM arguments, but none of them deal with specifying how many times the connection is retried.

I've determined that this is the root cause of the problem because amongst the endless list of exceptions is:

[java] Caused by: java.lang.RuntimeException: java.net.ConnectException: Connection refused

[java]at com.sun.enterprise.iiop.IIOPSSLSocketFactory.createSocket(IIOPSSLSocketFactory.java:356)

...

Trying to put a try/catch for Throwable around the lookup code doesn't solve anything - as I would expect. But I still gave it a shot.

Thanks for any tips.

- Chris

[1317 byte] By [fuzelogika] at [2007-10-3 3:33:31]
# 1

Hi Chris,

Thanks for bringing this to our attention.It's a usability issue for which we've filed a bug :

https://glassfish.dev.java.net/issues/show_bug.cgi?id=1026

You can set the following property to reduce the retry logic :

com.sun.corba.ee.transport.ORBCommunicationsRetryTimeout=1

--ken

ksaksa at 2007-7-14 21:27:54 > top of Java-index,Enterprise & Remote Computing,Enterprise Technologies...