1 Reply Latest reply on Nov 19, 2009 6:03 AM by lekoloku

    Custom resource factory accessible through JNDI

    jkostelansky1

      I have developed resource factory which produces desired objects and is accessible through JNDI context implementing javax.naming.spi.ObjectFactory. It is possible to register such a factory in tomcat's server.xml. However our new customer requires Jboss 4.0.x.
      I have found a lot of information regarding jboss-web.xml file, but noting how to actually register factory in jboss JNDI.

      So far I know Jboss offers 3 of box (JNDIBindingServiceMgr, NamingAlias and ExternalContext) context, but non of them fill fill my needs.

      I could have managed to successfully create JNDI reference through org.jboss.naming.JNDIBindingServiceMgr but this is limited to Java Beans or text values. What I need is to hook implementation javax.naming.spi.ObjectFactory interface to jboss JNDI.

      web.xml

      <web-app version="2.4">
       <description>test web application which tests custom jndi context</description>
      <resource-env-ref>
       <description>
       Object factory for test resource manager.
       </description>
       <resource-env-ref-name>
       res/TestresourceManager
       </resource-env-ref-name>
       <resource-env-ref-type>
       java.lang.String
       </resource-env-ref-type>
      </resource-env-ref>
      </web-app>

      jboss-web.xml
      <?xml version="1.0" encoding="UTF-8"?>
      <jboss-web>
      <resource-env-ref-name>res/TestresourceManager</resource-env-ref-name>
       <jndi-name>res/TestresourceManager</jndi-name>
      </jboss-web>


      Thank you in advance, Jan