Jboss EAP 6.0.0 : Remote EJB proxy cache for Swing client
seeaganesh May 28, 2013 3:48 AMHi,
We have an application deployed on Jboss EAP 6.0.0 on Linux. Application contains a SLSB. At client we have a swing based application. While the client starts, it gets the data from DB using the SLSB. Remote lookup is successful and i can call the remote EJB. Initially at client side we use to cache the looked up remotehome ( EJBHome)interfaces to avoid the lookups. Now with Jboss EAP 6.0.0 (jboss 7 +AS) this is changed and we are getting ejb proxies.
We tried to cache these proxies, just like we did for remotehome, but sometimes we get the following exception with the cached proxies.
java.lang.IllegalStateException: EJBCLIENT000025: No EJB receiver available for handling.
We are using application without this cache (and repetative lookups). I have not changed any configuration on server for ejb. Question is why we are not able to cache the proxies? How to see if the proxy is stale, and if it is stale then do lookup. Client code : We want to cache and resuse the object returned from this method (it return EJBObject )
private Object lookupRemoteHome(String jndiHomeName, boolean bRetry)
{
try
{
Properties env = new Properties();
env.put(INITIAL_FACTORY, contextFactoryName);
env.put(PROVIDER_URL, hostURI);
env.put(PRINCIPAL, user);
env.put(CREDENTIALS, password);
PropertyBag<String> bag = getPropertyBag();
if (bag != null && bag.size() > 0)
{
ListOrderedMap<String, String> propMap = bag.getProperties();
for (String key : propMap.keyList())
{
env.put(key, propMap.get(key));
}
}
env.put("jboss.naming.client.ejb.context", true);
env.put(javax.naming.Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
InitialContext ctx = new InitialContext(env);
return ctx.lookup(jndiHomeName);
}
catch (NamingException ne)
{
if (bRetry)
{
return lookupRemoteHome(jndiHomeName, false);
}
else
{
throw CommonExceptionFactory.createException(CommonExceptionEnum.Names.JNDILookupError, jndiHomeName, ne.getMessage(), ne);
}
}
}
2) jboss-ejb-client.properties
remote.connections=default
endpoint.name=client-endpoint
remote.connection.default.port = 4447
remote.connection.default.host=1.2.3.4
remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED=false
remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS=false
jboss.naming.client.ejb.context=true
Regards Ganesh