• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
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
Marshal
Posts: 34071
331
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
Marshal
Posts: 34071
331
Eclipse IDE Java VI Editor
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic