0 Replies Latest reply on Jun 30, 2011 9:07 PM by 872567

    Load external properties files into EJB 3 / EAR app running on WebLogic 11

    872567
      Am researching the best way to load external properties files from and EJB 3 app whose EAR file is deployed to WebLogic.

      Was thinking about using an init servlet but I read somewhere that it would be too slow (e.g. my message handler might receive a message from my JMS queue before the init servlet runs).

      Suppose I have multiple property files or one file here:

      ~/opt/conf/

      So far, I feel that the best possible solution is by using a Web Logic application lifecycle event where the code to read the properties files during pre-start:
      import weblogic.application.ApplicationLifecycleListener;
      import weblogic.application.ApplicationLifecycleEvent;
      
      public class MyListener extends ApplicationLifecycleListener {
        public void preStart(ApplicationLifecycleEvent evt) {
          // Load properties files
         } 
      }
      See: http://download.oracle.com/docs/cd/E13222_01/wls/docs90/programming/lifecycle.html

      What would happen if the server is already running, would post start be a viable solution?

      Can anyone think of any alternative ways that are better?

      Edited by: 869564 on Jun 30, 2011 2:06 PM