• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Ron McLeod
  • paul wheaton
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Devaka Cooray
Saloon Keepers:
  • Tim Holloway
  • Roland Mueller
  • Himai Minh
Bartenders:

one more confusion over bean things

 
Ranch Hand
Posts: 77
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In stateful session beans ejbActivate/ejbPssivate mathod, since there is client security context, bean can access 'other resource managers and other beans'. But even in afterCompletion method, there is client security context, but bean CANNOT access 'other resource managers and other beans'. Why?

Thanks,
Prashant
 
Ranch Hand
Posts: 250
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
since there is client security context, bean can access 'other resource managers and other beans'

Is this true ? Because of security context the bean can access other ejbs.


 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Could it be because the afterCompletion method, unlike the others, runs in a unspecified transaction context?
 
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Prashant,

You are very right this seems to be an inconsistency in the spec. The spec says:

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.



So since afterCompletion() does have client security context, accessing resource managers and enterprise beans should be allowed, but is not. I'm afraid you will just need to remember it for the exam :-).

See also the debate about the same issue.

Miki
 
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys

The intention of that method is to retain the bean state to before calling the transaction (If the transaction is failed). So that i think, they are disallowing to access the other EJB/Resource Manager.
 
Ranch Hand
Posts: 126
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hey Ranchers

At the bottom of page 79 in the spec it says that


If a session bean instance attempts to access a resource manager or an enterprise bean, and that access is
not allowed in Table 2, the behavior is undefined by the EJB architecture.



So, you can go ahead and access the resource manager and beans you want. But, the behavior you expect is not guaranteed.

By the way, "disallowed" does not mean NOT Allowed. It means to 'reject as improper'. My mother tounge is not English though, and I interpreted it as not allowed until I saw this post.
[ June 20, 2005: Message edited by: chowdary Thammineedi ]
 
KasiMurugan Ramasamy
Ranch Hand
Posts: 125
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Chowdary,

Yes, your absoultely correct.

Regards
Kasimurugan R.
 
Ranch Hand
Posts: 39
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Miki Muzsi:
Prashant,

You are very right this seems to be an inconsistency in the spec. The spec says:

So since afterCompletion() does have client security context, accessing resource managers and enterprise beans should be allowed, but is not. I'm afraid you will just need to remember it for the exam :-).

See also the debate about the same issue.

Miki



Its a stateful session bean. So the client's identity will be accessible in all the methods spanning from ejbCreate until the end of ejbRemove. Though afterCompletion() runs in unspecified transaction, it runs for the same client.

Aravind
 
Miki Muzsi
Ranch Hand
Posts: 120
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Aravind,

The point is:
afterCompletion()
- does have client info
- does run in an UTC and
but can NOT access 'other resource managers and other beans',

while ejbCreate() is in a similar situation:
- does have client info
- does run in an UTC
and CAN access 'other resource managers and other beans",

And the spec always motivates accessing resource managers or other ejb beans by:
QUOTE] 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.

That is why I say is a bit of inconsistency in the spec...

Miki
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic