3 Replies Latest reply on Jan 14, 2005 12:05 PM by jbriscoe

    File System ExternalContext Problem

    jbriscoe Newbie

      I am trying to load a directory's contents into JNDI, not an LDAP directory.
      I'm using JBoss 3.2.2RC3

      My jboss-service.xml file looks like this:

      ---- Begin $JBOSS_HOME/server/default/deploy/jboss-service.xml

      mbean code="org.jboss.naming.ExternalContext" name="DefaultDomain:service=ExternalContext,jndiName=external/fs/TEMP"
      attribute name="JndiName" external/fs/TEMP
      attribute name="Properties" jacob_fs.properties
      attribute name="Properties" jacob_fs.properties
      attribute name="InitialContext" javax.naming.InitialContext

      ---- End $JBOSS_HOME/server/default/deploy/jboss-service.xml

      My properties file looks like this:

      ---- Begin $JBOSS_HOME/server/default/conf/jacob_fs.properties


      ---- End $JBOSS_HOME/server/default/conf/jacob_fs.properties

      JBoss loads without any problems, it binds the name "external/fs/TEMP". What it does not do is recursively map the file "TEMP"'s contents, which is what I need to do.
      I've read several posts on this forum and the JBoss 2.4+ External JNDI and JNDI Viewing Docs and none have been completely helpfull. If somebody could please tell me what I'm doing wrong that would be greatly appreciated.

      Thanks in advance,

        • 1. Re: File System ExternalContext Problem
          jbriscoe Newbie

          After fighting with mounting a file system in JNDI with JBoss 3.2.2 I have finally solved the problem!
          I was going about some things in the wrong way first off, I needed a SAR file for the new fs external context that I was creating. The SAR's layout looks like this...


          That was my first problem that I solved, I was originally placing the jboss-service just in the deploy directory and putting the fscontext.jar & providerutil.jar in the server's lib directory.

          The second problem was the content of the jboss-service.xml file. This is what my WORKING jboss-service.xml file looks like.

          mbean code="org.jboss.naming.ExternalContext" name="jboss:service=ExternalContext,jndiName=external/fs"

          attribute name="JndiName" external/fs

          attribute name="Properties" java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory

          attribute name="InitialContext"
          attribute name="RemoteAccess" false

          -- End of File...

          No documentation that I could find on this subject says that the properties attribute may be of actual Property type.
          So all of that is working now. I deployed the .sar and everything works as planned.

          I hope this helps somebody.


          • 2. Re: File System ExternalContext Problem
            Jim Kski Newbie

            Hi Jacob-

            Thanks for posting your experience with ExternalContext and JBoss 3.2.3. I'm trying to follow your recipe using 3.2.5 and its not working out. When I use JNDIView to display the directory tree I can see the ExternalContext but its lowest level stops at the end of the path I defined in the JNDI path attribute (external/fs) and after that only displays $Proxy18.

            In the examples on this site, they show all the contents of the external context displayed (even in cases where a file system is bound into the directory). The JNDIView looks like this:

             +- external (class: org.jnp.interfaces.NamingContext)
             | +- fs (class: org.jnp.interfaces.NamingContext)
             | | +- data (class: org.jnp.interfaces.NamingContext)
             | | | +- mqfile (proxy: $Proxy18 implements interface javax.naming.Context)

            And my jboss-services.xml looks like this:

             <!-- Specify required library jars as needed.-->
             <classpath codebase="." archives="providerutil.jar,fscontext.jar"/>
            <!-- Added to enable external context federation -->
             <mbean code="org.jboss.naming.ExternalContext" name="jboss.jndi:service=ExternalContext,jndiName=external/fs/data/mqfile" >
             <attribute name="JndiName">external/fs/data/mqfile</attribute>
             <attribute name="Properties">java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory
             <attribute name="InitialContext">javax.naming.InitialContext</attribute>
             <attribute name="RemoteAccess">false</attribute>
            <!-- END: Added to enable external context federation -->

            My sar is configured identically to yours but still no luck. Any suggestions (Jacob or anyone else)?



            • 3. Re: File System ExternalContext Problem
              jbriscoe Newbie

              Sorry for taking so long to reply...


              You need this layout:

              You need these files here: providerutil.jar, fscontext.jar
              \META-INF (This directory is where you put the files you wish to mount.)
              You need these files here: jboss-service.xml, MANIFEST.MF
              jboss-service.xml looks like:
               <mbean code="org.jboss.naming.ExternalContext" name="jboss:service=ExternalContext,jndiName=external/fs" >
               <attribute name="JndiName">external/fs</attribute>
               <attribute name="Properties">
               <attribute name="InitialContext">javax.naming.InitialContext</attribute>
               <attribute name="RemoteAccess">false</attribute>
              MANIFEST.MF looks like:
              Manifest-Version: 1.0
              Ant-Version: Apache Ant 1.5.3
              Created-By: 1.4.2_02-b03 (Sun Microsystems Inc.)
              Built-By: jabrisco
              Sealed: false
              Class-Path: /external-fs.sar/fscontext.jar /external-fs.sar/providerut
              Name: common
              Specification-Title: File System Service
              Specification-Version: 1.0
              Specification-Vendor: My Company

              And thats it! If you have any questions or this doesn't work please let me know.

              Currently I'm even running JBoss 4.x and it still works perfectly.