Another problem I noticed is when we call SLSB using remote EJB calls, instance is new for each call.
Eg:
RemoteClient.java:
public void callRemoteEJB() {
TestRemote testRemote = getTestBean(); // Lookup remote EJB
testRemote.setUsers(); // This will set a list of users on SLSB
testRemote.processUsers(); // This will process users set by previous call
}
This code was working at JBoss 4.2.2.GA but in WildFly-8,2, I am getting NPE as the users set by previous call gets NULL on the next call
Finally I got it working.
I have removed jboss-ejb-client.properties file and used programmatic login method as suggested in the link.
final Properties ejbProperties = new Properties();
ejbProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false");
ejbProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
ejbProperties.put("remote.connections", "default");
ejbProperties.put("remote.connection.default.host", "localhost");
ejbProperties.put("remote.connection.default.port", "8080");
ejbProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false"); // needed for a login module that requires the password in plaintext
ejbProperties.put("remote.connection.default.username", "appUser");
ejbProperties.put("remote.connection.default.password", "plain-password");
//ejbProperties.put("org.jboss.ejb.client.scoped.context", "true"); // Not needed when EJBClientContext.setSelector is called programatically. ATTENTION: Client-Interceptor registration below does not work with this property! BUG?
ctx = new InitialContext(ejbProperties);
final EJBClientConfiguration ejbClientConfiguration = new PropertiesBasedEJBClientConfiguration(ejbProperties);
final ConfigBasedEJBClientContextSelector selector = new ConfigBasedEJBClientContextSelector(ejbClientConfiguration);
EJBClientContext.setSelector(selector);
EJBClientContext.getCurrent().registerInterceptor(0, new ClientInterceptor());
Also, I modified custom login module to set password for remote user.