Essam Raafat [
https://community.jboss.org/people/e_rafaat] created the discussion
"JBoss AS 7.1 - How to create application Client that uses a deployed EJB"
To view the discussion, visit:
https://community.jboss.org/message/746877#746877
--------------------------------------------------------------
Hello all,
I created a simple EJB called ProducerBean, and i want to test it using application
client,
public class Main {
public static void main(String[] args) {
// TODO Auto-generated method stub
InitialContext ctx;
try {
Properties jndiProps = new Properties();
jndiProps.put(Context.INITIAL_CONTEXT_FACTORY,
"org.jboss.naming.remote.client.InitialContextFactory");
jndiProps.put(Context.PROVIDER_URL,"remote://localhost:4447");
jndiProps.put(Context.SECURITY_PRINCIPAL,"adminUser");
jndiProps.put(Context.SECURITY_CREDENTIALS,
"93842b358571ba9fd3a537e47f36c26b");
ctx = new InitialContext(jndiProps);
Producer bean = (Producer)
ctx.lookup("java:global/JMS-tut1/ProducerBean");
System.out.println(bean.add(2,3));
} catch (NamingException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
/* (non-Java-doc)
* @see java.lang.Object#Object()
*/
public Main() {
super();
}
}
but when running this code, it throws the following exception
Jul 09, 2012 11:49:28 AM org.jboss.remoting3.remote.RemoteConnection handleException
ERROR: JBREM000200: Remote connection failed: javax.security.sasl.SaslException:
Authentication failed: all available authentication mechanisms failed
javax.naming.NamingException: Failed to create remoting connection [Root exception is
java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication failed: all
available authentication mechanisms failed]
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 Main.main(Main.java:23)
Caused by: java.lang.RuntimeException: javax.security.sasl.SaslException: Authentication
failed: all available authentication mechanisms failed
at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:87)
at
org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:56)
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)
... 5 more
Caused by: javax.security.sasl.SaslException: Authentication failed: all available
authentication mechanisms failed
at
org.jboss.remoting3.remote.ClientConnectionOpenListener$Capabilities.handleEvent(ClientConnectionOpenListener.java:365)
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.naming.remote.client.EndpointCache$EndpointWrapper.connect(EndpointCache.java:105)
at
org.jboss.naming.remote.client.NamingStoreCache.getRemoteNamingStore(NamingStoreCache.java:55)
... 8 more
any ideas ??
--------------------------------------------------------------
Reply to this message by going to Community
[
https://community.jboss.org/message/746877#746877]
Start a new discussion in EJB3 at Community
[
https://community.jboss.org/choose-container!input.jspa?contentType=1&...]