2 Replies Latest reply on Mar 7, 2012 4:56 PM by david.salter

    Startup Class in JBoss 7

    erg144

      I'm evaluating migration from Weblogic to JBoss.  The application (ppackaged in an ear file with 7 war files), depends on a startup class to initialize the spring container and populate our cache.

       

      When I look for ways to create a startup class, the documentation is a bit on the lean side.  From the forums, I gather I need to make a sar file (which is hard to find docs on) and in the sar i need a class extends the  interfaces  ServiceBean.  Well, that class dones not seem to exist in the new version of JBOSS, hence, I can not load my app (my spring context is not initialized, and my cache is not initialized).  Without spring and cache, I can not proceed.   

       

      Question:

       

      1 - Is ther any other way to create a LifeCycle type class that listens for the startup/shutdown

      2 - is there some simple docs on creating a SAR  (I think this must be a JBoss thing, it does not exist in WebLogic)

       

       

      Thanks

        • 1. Re: Startup Class in JBoss 7
          jnakatabe

          Couldn't you just annotate your initializer class with Startup + Singleton + PostConstruct?

          • 2. Re: Startup Class in JBoss 7
            david.salter

            A simpler, maybe less elegant solution, could be to create a servlet that loads at startup and perform initialization there.jboss 7 startup class

             

            If you're using an appropriate version of Java EE (EJB 3.1) then Josh's suggestion is a good one as this will ensure that initialization is performed before requests can be made to your EJBs.