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@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]

_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to