-
1. Re: Anonymous principal when invoking EJB from a thread inside a servlet
wdfink Aug 3, 2014 7:31 AM (in response to antlia)Manually creating threads is a EE spec violation, you can not expect that the security context is propagated correctly.
An option is to have a Asynchronous EJB method (EJB3.1).
What version of AS do you use?
-
2. Re: Anonymous principal when invoking EJB from a thread inside a servlet
antlia Aug 4, 2014 9:00 AM (in response to wdfink)Thanks for the reply Wolf-Dieter,
in effect i read that manually thread creation in a servlet is an EE violation but, when i made this solution I followed this tutorial (forgot to say that I'm using Vaadin framework)
https://vaadin.com/book/vaadin7/-/page/advanced.push.html
In 11.16.3. Accessing UI from Another Thread example a thread is explicitly spawned in server-side code..so i belived that it won't be a problem.
I'm using EAP 6.2.0 version
-
3. Re: Re: Anonymous principal when invoking EJB from a thread inside a servlet
antlia Sep 3, 2014 6:36 AM (in response to antlia)I've also tried manual login inside the thread with the code below:
UsernamePasswordHandler handler = new UsernamePasswordHandler(username, password.toCharArray()); try{ new LoginContext("other",handler).login(); caseManager = (CaseManagerLocal)new InitialContext().lookup(...); caseManager.getCaseList(); }
And even in this case, I'm not able to call the method, same exception.
I understand that spawning thread is a JEE violation, so I should not expect that the principal will be propagated correctly...but why I'm getting the same exception, even doing manual login in the login context?