AS7.1 Provider URL for clustered remote JNDI servers
ned233 Feb 21, 2012 3:13 PMDistribution: AS 7.1.0.Final
I have been able to successfully get an InitialContext using remoting, like this:
Properties props = new Properties();
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put(Context.PROVIDER_URL, "remote://server1:4447");
Context context = new InitialContext(props);
However, we have 2 servers in our cluster. In previous versions of JBoss, you could just comma-separate the provider URL's, like so:
props.put(Context.PROVIDER_URL, "remote://server1:4447,remote://server2:4447");
When I try this, I get the exception below. Is there another way to do this now?
javax.naming.NamingException: Failed to create remoting connection [Root exception is java.lang.IllegalArgumentException: destination address may not be null]
at org.jboss.naming.remote.client.ClientUtil.namingException(ClientUtil.java:36)
at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:117)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:667)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:288)
at javax.naming.InitialContext.init(InitialContext.java:223)
at javax.naming.InitialContext.<init>(InitialContext.java:197)
at com.fhlbi.cbs.common.util.RemoteQueueTest.main(RemoteQueueTest.java:34)
Caused by: java.lang.IllegalArgumentException: destination address may not be null
at org.jboss.remoting3.remote.RemoteConnectionProvider.connect(RemoteConnectionProvider.java:98)
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:296)
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:251)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:349)
at org.jboss.remoting3.EndpointImpl.connect(EndpointImpl.java:333)
at org.jboss.naming.remote.client.cache.EndpointCache$EndpointWrapper.connect(EndpointCache.java:110)
at org.jboss.naming.remote.client.cache.ConnectionCache.get(ConnectionCache.java:41)
at org.jboss.naming.remote.client.InitialContextFactory.createConnection(InitialContextFactory.java:153)
at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateConnection(InitialContextFactory.java:126)
at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:106)
... 5 more