Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Is there any way to initialize a class during EJB Module deployment?

 
Azrael Noor
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is there any way to initialize a class during deployment ?

I need to run a process during deployment only so that user intervene not require, when i restart server or so. This is my requirement.

Do you have any procedure to solve it please?



* Admins and Mods i am sorry i asked the question before in Servlets module and i got answer according to that only, but i have to make only EJB module, no web application work here.
So i need to ask question again here.
 
Jaikiran Pai
Marshal
Pie
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
EJB3.1 introduces a @Startup @Singleton which you can use to do that. Are you using EJB3.1?
 
Azrael Noor
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
No, Jaikarn i am not sing EJB 3.1
i am using EJB 3.0,
Jboss virgin 4.0.1 SP1.

Thank you very much for reply
 
Azrael Noor
Ranch Hand
Posts: 385
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) I used Servlet Context Listener for solving this purpose, made a bean in EJB Module and
while after 5 minutes it will send data to bean and data if recieved then it will insert that time to class. Multithreading is used in servlet.

2) Other methods need one time manual intervention for running a class or jsp or whatever and it was required to run the class during deployment and find no method to do so in ejb-3.0 and jboss4.0

Thank you for you helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic