This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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 ]