Question regarding the EJB invocations from a remote client using JNDI example
foutjo Feb 18, 2012 7:15 AMI tried running a version of the SLSB example from the following:
https://docs.jboss.org/author/display/AS71/EJB+invocations+from+a+remote+client+using+JNDI
My problem is I have two connections supported in the client's jboss-ejb-client.properties file but yet all of the requests only go to the first connection defined in the remote.connections= definition.
I'm running as-7.1.0.Final
Here is my client's jboss-ejb-client.properties file:
------------------------------------
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connections=default, two
remote.connection.default.host=10.100.100.12
remote.connection.default.port = 4447
remote.connection.default.username=xxxx
remote.connection.default.password=xxxx
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
remote.connection.two.host=10.100.100.2
remote.connection.two.port = 4447
remote.connection.two.username=xxx
remote.connection.two.password=xxxx
remote.connection.two.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
------------------------------------
Started both servers using the standalone.xml
Executed client several times and all client requests go to connection "default".
If I change the jboss-ejb-client.properties to:
remote.connections=two, default
Then all client requests go to connection two.
Here is my code for the lookup and invocation of the SLSB from the client:
final Hashtable<String,String> jndiProperties = new Hashtable<String, String>();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
final Context context = new InitialContext(jndiProperties);
final String appName = "";
final String moduleName = "LIDP-ADMI2";
final String distinctName = "";
final String beanName = "CalculatorBean";
final String viewClassName = RemoteCalculator.class.getName();
String bean = "ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName;
final RemoteCalculator statelessRemoteCalculator = (RemoteCalculator) context.lookup(bean);
....
....
int sum = statelessRemoteCalculator.add(a, b);
int difference = statelessRemoteCalculator.subtract(num1, num2);
The client requests should be going to both connections correct?
If yes is there something that I am not setting up correctly?
Thanks.