I am currently running into a situation where on starting my application on JBoss 4, deployment fails as follows:
2009-08-20 21:30:13,527 DEBUG [org.jnp.interfaces.NamingContext] Failed to connect to 10.0.100.232:1099
javax.naming.CommunicationException: Failed to connect to server 10.0.100.232:1099 [Root exception is javax.naming.ServiceUnavailableException: Failed to connect to server 10.0.100.232:1099 [Root exception is java.net.ConnectException: Connection refused]]
at org.jnp.interfaces.NamingContext.getServer(NamingContext.java:269)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1385)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:594)
at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at org.springframework.jndi.JndiTemplate$1.doInContext(JndiTemplate.java:132)
at org.springframework.jndi.JndiTemplate.execute(JndiTemplate.java:88)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:130)
at org.springframework.jndi.JndiTemplate.lookup(JndiTemplate.java:155)
at org.springframework.jndi.JndiLocatorSupport.lookup(JndiLocatorSupport.java:93)
at org.springframework.jndi.JndiObjectLocator.lookup(JndiObjectLocator.java:105)
at org.springframework.jndi.JndiObjectFactoryBean.lookupWithFallback(JndiObjectFactoryBean.java:197)
at org.springframework.jndi.JndiObjectFactoryBean.afterPropertiesSet(JndiObjectFactoryBean.java:184)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1203)
...
because a necessary JNDI resource (a JMS queue) cannot be located because the remote JBoss instance being queried is down due to it also being restarted.
Is there a way to configure JBoss so that JNDI lookup attempts are performed over a longer period of time during startup so that I have a chance of catching the remote machine once it has come back up?