File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes EJB container - how to initialize a class at server startup ? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "EJB container - how to initialize a class at server startup ?" Watch "EJB container - how to initialize a class at server startup ?" New topic
Author

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

Alex M. De Luca
Greenhorn

Joined: Jun 04, 2008
Posts: 1
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
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

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.


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29220
    
135

And welcome to JavaRanch!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: EJB container - how to initialize a class at server startup ?
 
Similar Threads
Web container restrictions?
Using JBoss
ejb-link element....
EJB Container's Job.....
j2ee 1.3???