Remoting works locally, but not remotely
rvdkrogt May 23, 2012 11:02 AMHi all,
I ran into some issue with moving our application from JBoss 6 to 7 (7.1.1.Final), so I decided to focus on getting some of the quickstarts to work first, and learn from that. I'm stuck now, however, on the remoting quickstart (ejb-remote). I have successfully deployed it, and the client works from the local machine. However, I'm getting the following exceptions when I try to run the client from a different machine:
ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
23-May-2012 15:26:45 org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector setupEJBReceivers
WARN: Could not register a EJB receiver for connection to remote://XXXXXXXXXXXXXXXXXXX:4447
java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
at org.jboss.ejb.client.remoting.IoFutureHelper.get(IoFutureHelper.java:91)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:121)
at org.jboss.ejb.client.remoting.ConfigBasedEJBClientContextSelector.<init>(ConfigBasedEJBClientContextSelector.java:78)
at org.jboss.ejb.client.EJBClientContext.<clinit>(EJBClientContext.java:77)
at org.jboss.ejb.client.EJBClient.createSession(EJBClient.java:160)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.doCreateProxy(EjbNamingContext.java:135)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:113)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.lookup(EjbNamingContext.java:96)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.lookupRemoteStatefulCounter(RemoteEJBClient.java:167)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.invokeStatefulBean(RemoteEJBClient.java:78)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.main(RemoteEJBClient.java:39)
Caused by: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:315)
at org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:214)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
at org.xnio.channels.TranslatingSuspendableChannel.handleReadable(TranslatingSuspendableChannel.java:189)
at org.xnio.channels.TranslatingSuspendableChannel$1.handleEvent(TranslatingSuspendableChannel.java:103)
at org.xnio.ChannelListeners.invokeChannelListener(ChannelListeners.java:72)
at org.xnio.nio.NioHandle.run(NioHandle.java:90)
at org.xnio.nio.WorkerThread.run(WorkerThread.java:184)
at ...asynchronous invocation...(Unknown Source)
at org.jboss.remoting3.EndpointImpl.doConnect(EndpointImpl.java:270)
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.ejb.client.remoting.ConfigBasedEJBClientContextSelector.setupEJBReceivers(ConfigBasedEJBClientContextSelector.java:119)
... 10 more
23-May-2012 15:26:45 org.jboss.remoting3.remote.RemoteConnection handleException
ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: all available authentication mechanisms failed
Exception in thread "main" javax.naming.NamingException: Failed to create proxy [Root exception is java.lang.IllegalStateException: No EJB receiver available for handling [appName:JBoss7Test,modulename:JBoss7TestEJB,distinctname:] combination]
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:115)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.lookup(EjbNamingContext.java:96)
at javax.naming.InitialContext.lookup(Unknown Source)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.lookupRemoteStatefulCounter(RemoteEJBClient.java:167)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.invokeStatefulBean(RemoteEJBClient.java:78)
at org.jboss.as.quickstarts.ejb.remote.client.RemoteEJBClient.main(RemoteEJBClient.java:39)
Caused by: java.lang.IllegalStateException: No EJB receiver available for handling [appName:JBoss7Test,modulename:JBoss7TestEJB,distinctname:] combination
at org.jboss.ejb.client.EJBClientContext.requireEJBReceiver(EJBClientContext.java:517)
at org.jboss.ejb.client.EJBClient.createSession(EJBClient.java:161)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.doCreateProxy(EjbNamingContext.java:135)
at org.jboss.ejb.client.naming.ejb.EjbNamingContext.createEjbProxy(EjbNamingContext.java:113)
... 5 more
Using tcpdump, I can see the client and server exchanging messages, so I'm sure there is no issue with the connection itself.
The code that performs the lookup is as follows:
private static RemoteCounter lookupRemoteStatefulCounter() throws NamingException {
final Hashtable jndiProperties = new Hashtable();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiProperties.put(Context.SECURITY_PRINCIPAL, "test");
jndiProperties.put(Context.SECURITY_CREDENTIALS, "1234");
final Context context = new InitialContext(jndiProperties);
return (RemoteCounter) context.lookup("ejb:JBoss7Test/JBoss7TestEJB//CounterBean!" + RemoteCounter.class.getName()+"?stateful");
}
The lines in bold are added by me, and correspond to the user/pass that was created for the ApplicationRealm. Otherwise, the code is as in the quickstart, except that I removed the comments here for brevity, and changed the id to look up
My jboss-ejb-client.properties looks as follows. (Note that in the current form it also lists the user and pass. I've tried specifying these only in the code, only in the properties file, in both and in neither as well, but always with the same outcome).
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default
remote.connection.default.host=XXXXXXXXXXXXXXXXXXXXXX
remote.connection.default.port=4447
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.username=test
remote.connection.password=1234
As I said, it all works brilliantly locally, but not from a different server. I must be missing some config option somewhere. Any and all pointers welcome.
Thanks,
Roman.