EJB Remote Client - javax.naming.NamingException: Failed to connect to any server. Servers tried: [remote://localhost:8080]
srpa0117 May 19, 2017 5:25 AMHi,
I have created a sample Stateless session bean and deployed to Wildfly 10.x.
Then I wrote a standalone clinet program to invoke the ejb, but it got failed with below error.
Could you please help.
Attached the server and standalone client logs.
5373 [main] DEBUG org.jboss.naming.remote.client.InitialContextFactory - jboss.naming.client.connect.options. has the following options {org.xnio.Options.SASL_POLICY_NOPLAINTEXT=>false}
10381 [main] DEBUG org.jboss.naming.remote.client.HaRemoteNamingStore - Failed to connect to server remote://localhost:8080
java.lang.RuntimeException: Operation failed with status WAITING
at org.jboss.naming.remote.protocol.IoFutureHelper.get(IoFutureHelper.java:89)
at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:193)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:144)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:125)
at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:241)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)
at javax.naming.InitialContext.lookup(Unknown Source)
at WildflyEJBClient.RemoteClient.main(RemoteClient.java:44)
Exception in thread "main" javax.naming.NamingException: Failed to connect to any server. Servers tried: [remote://localhost:8080]
at org.jboss.naming.remote.client.HaRemoteNamingStore.failOverSequence(HaRemoteNamingStore.java:213)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingStore(HaRemoteNamingStore.java:144)
at org.jboss.naming.remote.client.HaRemoteNamingStore.namingOperation(HaRemoteNamingStore.java:125)
at org.jboss.naming.remote.client.HaRemoteNamingStore.lookup(HaRemoteNamingStore.java:241)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:79)
at org.jboss.naming.remote.client.RemoteContext.lookup(RemoteContext.java:83)
at javax.naming.InitialContext.lookup(Unknown Source)
at WildflyEJBClient.RemoteClient.main(RemoteClient.java:44)
Client code:
Properties props = new Properties();
// For local wildfly
props.put(Context.INITIAL_CONTEXT_FACTORY, "org.jboss.naming.remote.client.InitialContextFactory");
props.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
props.put("jboss.naming.client.ejb.context", true);
props.put("java.naming.provider.url","remote://localhost:8080");
props.put(Context.SECURITY_PRINCIPAL, "XXXX");// passed valid values from add-user.bat
props.put(Context.SECURITY_CREDENTIALS, "XXX");// passed valid values from add-user.bat
InitialContext context = new InitialContext(props);
HelloWorldRemote exampleBean = (HelloWorldRemote) context.lookup("SampleEJBProj/HelloWorld!com.ejbs.HelloWorldRemote");
System.out.println(exampleBean.getMessage());
-
server_logs.txt.zip 2.4 KB