Unable to do a simple remote EJB lookup.
blakecmartin Mar 28, 2014 2:45 PMI'm trying to look up an EJB on a remote server from a Java application on my local machine. I've set up an application user in WildFly 8.0.0 and am running in standalone-full mode. The EJB deployed successfully.
When I try to look up the EJB using the following code (which I'm sure is wrong due to the JNDI name), I get the following error:
- ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException: Authentication failed: the server presented no authentication mechanisms
Any idea as to what the problem could be?
Thanks,
Blake
| String host = "172.16.18.39"; | ||
| Properties clientProperties = new Properties(); | ||
| clientProperties.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory"); | ||
| clientProperties.put(Context.PROVIDER_URL, "http-remoting://" + host + ":8080"); | ||
| clientProperties.put(Context.SECURITY_PRINCIPAL, "abc"); | ||
| clientProperties.put(Context.SECURITY_CREDENTIALS, "123"); | ||
| clientProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming"); | ||
| clientProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false"); | ||
| clientProperties.put("remote.connections", "default"); | ||
| clientProperties.put("remote.connection.default.port", 8080); | ||
| clientProperties.put("remote.connection.default.host", host); | ||
| clientProperties.put("remote.connection.default.username", "abc"); | ||
| clientProperties.put("remote.connection.default.password", "123"); | ||
| clientProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false"); |
| EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(clientProperties); | |
| ContextSelector<EJBClientContext> contextSelector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration); | |
| EJBClientContext.setSelector(contextSelector); |
| Context context = new InitialContext(clientProperties); | |
| context.lookup("java:global/ejb-ear-1.0/an-ejb-1.0/SomeEjb!com.xyz.ejb.SomeEjbRemote"); |