This week's book giveaway is in the Cloud/Virtualizaton forum.
We're giving away four copies of Mesos in Action and have Roger Ignazio on-line!
See this thread for details.
Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to auto execute a session bean’s method on ear deployment?

 
Sib Pete
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I need a way to have a session bean's method executed periodically every week at a certain time. I am thinking of using the quartz scheduler to do this. My question is, how do I start the scheduler to run from the moment the .ear file is deployed automatically? Is there any annotation that I can use on the stateless session bean calling the scheduler.start method such as @PostConstruct or something?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34401
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I know you can set a servlet to init/load automatically on ear deployment. Not sure how to do so for an EJB. You could always write a servlet which calls your EJB.
 
Sib Pete
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How do you set up a servlet to load automatically on ear deployment?
 
Jeanne Boyarsky
author & internet detective
Marshal
Posts: 34401
346
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sib Pete wrote:How do you set up a servlet to load automatically on ear deployment?

In the web.xml. See this example
 
Sib Pete
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If I cant auto execute an ejb method on deployment, then I will have to go with this I guess. Thanks. Really helps a lot.
 
Shane Lee
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Any update on this Sib?

My enterprise application only has a backend, and all ive found on the net is using servlet to initialise the scheduler.
My goal is to automate method invocation on one of my stateless session beans, periodically via cron trigger.

Any clues?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic