HA JNDI peculiar behavior ?
amyrlinseat Aug 19, 2004 4:17 AMHi all,
I have 2 JBoss instances (3.2.3 on Windows 2003) in a cluster, and I have a client Java application (in a separate VM) that tries a JNDI lookup. The Jndi.Properties of the client is:
java.naming.factory.initial=org.jnp.interfaces.NamingContextFactory
java.naming.factory.url.pkgs=org.jboss.naming:org.jnp.interfaces
So since provider url is not defined, it should look for the HA Jndi.
I create the initial context in the usual way:
javax.naming.InitialContext initialContext = new javax.naming.InitialContext();
when I do initialContext.lookup(), it succeeds or fails as follows:
If the 2 JBoss instances are up, the lookup succeeds.
If the 2 JBoss instances were up, and then one goes down, I am left with a single JBoss - the lookup succeeds.
If only a single JBoss is up, the lookup fails!
The exception I get is below.
Is this behavior by design or is it a bug.
If it is by design, what is the intention of this design. I would like the client to succeed in all cases. Why should it care that the cluster has only 1 node?
TIA
Evyatar.
javax.naming.CommunicationException: Receive timed out [Root exception is java.net.SocketTimeoutException: Receive timed out]
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1115)
at org.jnp.interfaces.NamingContext.checkRef(NamingContext.java:1223)
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.ipontis.platform.events.test.RemoteEjbTest.testSimpleClusteredEjb(RemoteEjbTest.java:54)
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:324)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:392)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:276)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:167)
Caused by: java.net.SocketTimeoutException: Receive timed out
at java.net.PlainDatagramSocketImpl.receive(Native Method)
at java.net.DatagramSocket.receive(DatagramSocket.java:711)
at org.jnp.interfaces.NamingContext.discoverServer(NamingContext.java:1093)
... 18 more