[jboss-user] [JBoss Remoting] - [JBoss7] Remote EJB3 calls from spawned thread

dario novakovic do-not-reply at jboss.com
Wed Jul 18 07:24:59 EDT 2012


dario novakovic [https://community.jboss.org/people/ndario] created the discussion

"[JBoss7] Remote EJB3 calls from spawned thread"

To view the discussion, visit: https://community.jboss.org/message/748720#748720

--------------------------------------------------------------
I have simple remote ejb client that calls remote stateless beans. There is security enabled on the server.

 All is well for single threrad, authentication and authorization and remote call works:

final Properties jndiProperties = new Properties();
jndiProperties.put(Context.URL_PKG_PREFIXES, "org.jboss.ejb.client.naming");
jndiProperties.put(Context.SECURITY_PRINCIPAL, "XXX");
jndiProperties.put(Context.SECURITY_CREDENTIALS, "XXX");
jndiProperties.put("jboss.naming.client.ejb.context", true);
jndiProperties.put(Context.PROVIDER_URL, "remote://serverIP:4447");
jndiProperties.put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false");
jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY, org.jboss.naming.remote.client.InitialContextFactory.class.getName());

Context context = new InitialContext(jndiProperties);

RemoteService rs = (RemoteService)context.lookup("ejb:app/app-ejb-1.0-SNAPSHOT/RemoteBean!com.app.services.remoting.RemoteService");
rs.myMethod();

So far so good, authentication is OK and remote call *works*.


However, If i make remote call from another thread, like from event handler in GUI application, I get:

java.lang.IllegalStateException: No EJB receiver available for handling [appName:app,modulename:app-ejb-1.0-SNAPSHOT,distinctname:] combination for invocation context org.jboss.ejb.client.EJBClientInvocationContext at 12a55aa

I realised that reason for this is that EJB security context is thread local var and it is missing in all spawned threads. Am I right?

What am I supposed to do tao make secured EJB remote calls from event handlers?
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/748720#748720]

Start a new discussion in JBoss Remoting at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2050]

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20120718/8768932f/attachment.html 


More information about the jboss-user mailing list