• Post Reply Bookmark Topic Watch Topic
  • New Topic

Calling EJB method from java.util.Timer

 
Kedar Dravid
Ranch Hand
Posts: 333
  • Mark post as helpful
  • send pies
  • 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.
 
Mark Spritzler
ranger
Sheriff
Posts: 17290
9
IntelliJ IDE Mac Spring
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!