Pt 1: Invoking the getCallerPrincipal and isCallerInRole methods is disallowed in the session bean methods for which the Container does not have a client security context.
Pt 2: "Accessing resource managers and enterprise beans is disallowed in the session bean methods for which the Container does not have a meaningful transaction context or client security context."
For afterCompletion method spec says we can call isCallerInRole so that means it has Security Context, then why is it not allowed to access Resource Managers or other beans according to Pt 2?
When there is no transaction context, you cannot access resource manager.
After the transaction is 'commited' or 'rolled back' then only 'afterCompletion' method is called. since the transaction is already completed and there is no meaning full transaction (no transaction context) left for 'afterCompletion' method we could not call any resource manager.
When there is no transaction context, you cannot access resource manager.
The Spec doesnt say so, the spec says there should be either Tx Contextor Security Context to access the Resource manager and other beans!
So in afterCompletion we have security context (as calling gerCallerPrincipal) is allowed, so this means we should be able to access the Resource managers also. Am i Clear?
I don't have the answer for the question you posted earlier. so i waited any one else in the group might answer but still i did not found the answer. So i posted the same in another forum. please find the conversation there.
I am not sure wheather it is good or bad to post the conversation held in some other forum at this place. But considering that the conversation will help you & others i am adding a link below to refer it.
please find the link http://forum.java.sun.com/thread.jspa?threadID=5188530&messageID=9743543#9743543