1 Reply Latest reply on Aug 14, 2003 9:34 PM by Jon Barnett

    Custom resources  in JNDI

    etienneb Newbie

      I'd like to bind an object to a specific JNDI name so that I can retrieve a reference to my object through InitialContext. This can be done in Tomcat by building an object factor object implementing javax.naming.spi.ObjectFactory, referencing it in a resource-env-ref element in web.xml and in server.xml using Resource and ResourceParams elements.

      Is it possible to do something similar in jboss so that I have an object factory bound to the JNDI tree? TIA


        • 1. Re: Custom resources  in JNDI
          Jon Barnett Master

          You can although most likely, you will need to perform the binding and control through an MBean. JBoss has plenty of examples in the source related to the Naming Server, with classes implementing the javax.naming.spi.ObjectFactory. However, the use and invocation may not be that apparent.

          Perhaps a simpler example is from the pool branch in JBoss source. This demonstrates an object pool, the MBean required to bind the object pool, and the invocation of the object factory to generate/retrieve and object from the pool.

          Hope that helps.