Hi all, I have a java class, not servlet. I want to load this class as soon as servlet container starts. In that java class I have written some code in static block, which is executed as soon as class is loaded into JVM. Thanks, Shashi.
1. Create a class implementing javax.serlvet.ServletContextListener 2. Implement both contextDestroyed and contextInitialized 3. Instanciate your class in contextInitialized 4. Declare the listener in web.xml using the <listener> tag
Suppose your class is student,you create a subdirectory as part of bea directory in the weblogic and place the student.class.Before starting your weblogic set the class path to student.class and start the server.
Just make sure you NEED that class loaded at startup.
Lazy Loading should be the rule, not the exception. I once workd on a massive piece of iron that took 30 minutes to boot, just because the developers decided every EJB had to be in memory before the application should handle any client requests.
Lazy Loading Rocks. Everyone, BE LAZY!!! [ August 27, 2006: Message edited by: Bear Bibeault ]
subject: how to load a class on app server startup