Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB container - how to initialize a class at server startup ?  RSS feed

 
Alex M. De Luca
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am using EJB3 and I need to call a class that initializes some configuration when the EJB container is initialized. This must be done before any EJB is called. Is there any way to do that ? I thought I could use something like the servlet container's context listener, but there isn't anything like that in the EJB container. Does anybody have a suggestion ?
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36406
454
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alex,
There isn't a "load on startup" type thing that I know of. Why not make a class that does the initial configuration and make it a static variable in your EJB. This will guarantee it runs before the EJB is called.
 
Jeanne Boyarsky
author & internet detective
Sheriff
Posts: 36406
454
Eclipse IDE Java VI Editor
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!