Loading a class file immediately AFTER startup

Posted by Striker on Stack Overflow See other posts from Stack Overflow or by Striker
Published on 2010-03-17T18:57:36Z Indexed on 2010/03/17 19:01 UTC
Read the original article Hit count: 319

Filed under:
|
|

We have a few war files deployed inside an ear file. Some of the war files have a class that caches static data from our PLM system in singletons. Since some of the classes take several minutes to load we use the load-on-startup in the web.xml to load them ahead of time. This all works fine until we attempt to re-deploy the application on our production servers. (WebLogic 10.3) We get an exception from our PLM API about a dll already being loaded. Our PLM vendor has confirmed that this is a problem and stated that they don't support using the load-on-startup. This is also a huge problem on our development boxes where we have redeploy the app all the time. Most of us, when we're not working on one of the apps that uses a cache, have them commented out. Obviously we can't do that for the production servers. Right now we transfer the ear to the production server, deploy it in the console, wait for it to crash, shut the app server instance down and then start it up again.

We need to find a way around this...

One suggestion was to create a servlet that we can call after the server boots that will load the various caches. While this will work I'm looking for something a bit cleaner. Is there anyway to detect once the server started and then fire off the methods?

Thanks.

© Stack Overflow or respective owner

Related posts about java

Related posts about web.xml