aspose file tools*
The moose likes EJB Certification (SCBCD/OCPJBCD) and the fly likes Doubt in afterCompletion Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Certification » EJB Certification (SCBCD/OCPJBCD)
Bookmark "Doubt in afterCompletion" Watch "Doubt in afterCompletion" New topic
Author

Doubt in afterCompletion

Venkatesh Rangamani
Ranch Hand

Joined: Aug 24, 2005
Posts: 31
Ranchers,
In EJB 2.0 Spec Pg 81, it is said that

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?

Thanks
Venkat.
NareshAnkuskani Kumar
Ranch Hand

Joined: Sep 15, 2005
Posts: 76
Hi venkatesh,

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.

let me know i am correct or not

NareshAnkuskani Kumar
Ranch Hand

Joined: Sep 15, 2005
Posts: 76
one more point to remind you is

transaction context is for calling resouce managers.

security context is for calling other beans.

so, in 'afterCompletion' method you cannot access resource managers & can call other bean method.
Venkatesh Rangamani
Ranch Hand

Joined: Aug 24, 2005
Posts: 31
Naresh

When there is no transaction context, you cannot access resource manager.

The Spec doesnt say so, the spec says there should be either Tx Context or 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?

Thanks
Venkat
NareshAnkuskani Kumar
Ranch Hand

Joined: Sep 15, 2005
Posts: 76
Hi Venkatesh,

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
Venkatesh Rangamani
Ranch Hand

Joined: Aug 24, 2005
Posts: 31
Thanks Very Much Naresh. I think its an oversight in the spec.

Venkat
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Doubt in afterCompletion
 
Similar Threads
one more confusion over bean things
afterCompletion method
access to other beans and RMCFs?
interesting.
operations allowed in the methods of SFSB