3 Replies Latest reply on Dec 9, 2002 2:28 AM by owulff

    Sharing objects among session beans

    owulff

      I use the ServletContext to share objects among servlets. This objects are singletons or object references to corba services.

      What possibilities do I have in EJB to share objects among session beans?

      I use a servlet which stores some objects in the ServletContext during startup of the engine. How can I do this with EJB?

      Thanks for your help!

      Oliver

        • 1. Re: Sharing objects among session beans
          owulff

          I want to precise my problem. During startup, I initialize my Corba Orb and store it in the servlet context. I've still no idea how I can solve this in EJB.

          Should I write just a singleton object which returns the Orb? How can I initialize the Orb during startup of JBoss?

          Oliver

          • 2. Re: Sharing objects among session beans
            mjremijan

            As far as I can tell this cannot be done. Session beans are a service and only become available once a service start. There is no "starting point" like an init() method, at least as far as I can tell. However, you can approximate the behavior with a static property/method call of a shared library. If you put a library in /lib/ext, then the first time a session bean make a call, it will be initialized. Other session beans will be able to grab the same reference.

            • 3. Re: Sharing objects among session beans
              owulff

              What about writing an MBean which does some core initialization and stores common objects in JNDI?
              Where can I find information about writing my own mbeans which fit in the jBoss architecture?