• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Calling EJB method from java.util.Timer

 
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am trying to call an EJB session bean method from within a java.util.Timer object. I want this method to be executed repeatedly over specific intervals. I have implemented JAAS security.
The Timer is called from a servlet's init() method. This results in the following error:
Authorization failed for /UNAUTHENTICATED while invoking (Home)ejb/com/dcx/sp/bl/bcf/ejb/AdministrativeQueryProviderHome create:2 securityName: /UNAUTHENTICATED;accessID: null is not granted any of the required roles: All
Non-application exception occurred while processing method "create". Exception data: com.ibm.websphere.csi.CSIException: SECJ0053E: Authorization failed for /UNAUTHENTICATED while invoking (Home)ejb/com/dcx/sp/bl/bcf/ejb/AdministrativeQueryProviderHome create:2 securityName: /UNAUTHENTICATED;accessID: null is not granted any of the required roles: All

Now, the same code (without the Timer part), if executed from the servlet's init() method, works correctly. When executed with Timer functionality, the call to the session bean's create() method is failing with the above error.

What could be the reason that the code fails when invoked through a Timer object? BTW, i am using J2EE 1.3.
 
ranger
Posts: 17347
11
Mac IntelliJ IDE Spring
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well to state the obvious the accessID is null.

So somehow that is not getting propagated to the Timer object from the Servlet.

Mark
 
Kedar Dravid
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thats right. But what i can't understand is that the same code when removed from the Timer class and put directly into the servlet's init() method, works perfectly. But as soon as the same code is put throught the Timer, it throws this error.
Is it because of some constraint of J2EE 1.3? While surfing the net to resolve this, I learnt that in J2EE 1.4, a Timer service for exactly the kind of functionality that I am trying to achieve, has been introduced. But then I am stuck with J2EE 1.3.
 
reply
    Bookmark Topic Watch Topic
  • New Topic