Remote EJB Context Initialization fails
mhille Feb 15, 2013 5:52 AMHello all,
i have a backend server application which is running on the jboss-7.1.1 server. This application consists of several statless beans.
First the frontend and backend run on the same server and it works. Now i want to seperate the two parts from each other and it get following exception when im trying to get initialContext:
NFO: XNIO NIO Implementation Version 3.0.3.GA
Feb 15, 2013 11:32:56 AM org.jboss.remoting3.EndpointImpl <clinit>
INFO: JBoss Remoting version 3.2.3.GA
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:121)
at javax.naming.spi.NamingManager.getInitialContext(Unknown Source)
at javax.naming.InitialContext.getDefaultInitCtx(Unknown Source)
at javax.naming.InitialContext.init(Unknown Source)
at javax.naming.InitialContext.<init>(Unknown Source)
at de.msg.TestClient.getInitialContext(TestClient.java:32)
at de.msg.TestClient.startRemoteConnection(TestClient.java:12)
at de.msg.TestClient.main(TestClient.java:41)
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.EndpointCache$EndpointWrapper.connect(EndpointCache.java:105)
at org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:55)
at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateCachedNamingStore(InitialContextFactory.java:166)
at org.jboss.naming.remote.client.InitialContextFactory.getOrCreateNamingStore(InitialContextFactory.java:139)
at org.jboss.naming.remote.client.InitialContextFactory.getInitialContext(InitialContextFactory.java:104)
... 7 more
With telnet i can connect to the backend, but i have to start the jboss server with: standalone.bat -b "0.0.0.0"
The following code shows the initialization of the context :
/**
* getting intialcontext for jb
* @return
*/
@SuppressWarnings("unchecked")
private InitialContext getInitialContext() {
@SuppressWarnings("rawtypes")
Hashtable props = new Hashtable();
props.put(Context.INITIAL_CONTEXT_FACTORY,
org.jboss.naming.remote.client.InitialContextFactory.class.getName());
props.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
props.put("jboss.naming.client.ejb.context", true);
props.put(Context.PROVIDER_URL, "remote://x.x.x.x:4447");
props.put(Context.SECURITY_PRINCIPAL, "test");
props.put(Context.SECURITY_CREDENTIALS, "123");
try {
return new InitialContext(props);
} catch (NamingException e) {
e.printStackTrace();
return null;
}
}
The user and password are already created on the jboss server.