4 Replies Latest reply on Jun 8, 2006 2:08 PM by Mark Moales

    Binding objects in JNDI similar to Tomcat GlobalNamingResour

    Mark Moales Newbie

      I'm trying to bind a Jackrabbit repository in JNDI under JBoss (4.0.3SP1). In the Jackrabbit documentation, they describe how to do this under tomcat using the GlobalNamingResources/Resource tags in server.xml and ResourceLink tag in context.xml. This all works fine.

      Now I want to do the same thing under JBoss. I've tried modifying server.xml and context.xml in jbossweb-tomcat55.sar, but this doesn't appear to work. I've looked at using JNDIBindingServiceMgr, but I can't figure out how to use it for this type of binding.

      Anyway, here's the Resource entry from tomcat:

      <Resource name="jcr/globalRepository"
       auth="Container"
       type="javax.jcr.Repository"
       factory="org.apache.jackrabbit.core.jndi.BindableRepositoryFactory"
       configFilePath="/path/to/repository.xml"
       repHomeDir="/path/to/repository"/>


      Here's the ResourceLink from tomcat:

      <ResourceLink name="jcr/globalRepository"
       global="jcr/globalRepository"
       type="javax.jcr.Repository"/>


      In my servlet on tomcat, I can then simply do the following to locate the repository:

      InitialContext nameCtx = new InitialContext();
      Context environment = (Context) nameCtx.lookup("java:comp/env");
      Repository repository =
       (Repository) environment.lookup("jcr/globalRepository");


      Can anyone shed some light on how to do this in JBoss?

      Thanks!

      Mark