-
1. Re: File System ExternalContext Problem
jbriscoe Feb 13, 2004 7:55 AM (in response to jbriscoe)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...
$JBOSS_HOME/server/default/deploy/external-fs.sar
/fscontext.jar
/providerutil.jar
/META-INF
/META-INF/MANIFEST.MF
/META-INF/jboss-service.xml
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
java.naming.provider.url=file:///TEMP
attribute name="InitialContext"
javax.naming.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.
Jacob -
2. Re: File System ExternalContext Problem
jimkski Jul 16, 2004 1:57 PM (in response to jbriscoe)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:<server> <!-- 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 java.naming.provider.url=file:///c:/data/mqfile</attribute> <attribute name="InitialContext">javax.naming.InitialContext</attribute> <attribute name="RemoteAccess">false</attribute> </mbean> <!-- END: Added to enable external context federation --> </server>
My sar is configured identically to yours but still no luck. Any suggestions (Jacob or anyone else)?
Thanks,
Jim -
3. Re: File System ExternalContext Problem
jbriscoe Jan 14, 2005 12:05 PM (in response to jbriscoe)Sorry for taking so long to reply...
Layout
You need this layout:C:\jboss\server\default\deploy\external-fs.sar 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: <server> <mbean code="org.jboss.naming.ExternalContext" name="jboss:service=ExternalContext,jndiName=external/fs" > <attribute name="JndiName">external/fs</attribute> <attribute name="Properties"> java.naming.factory.initial=com.sun.jndi.fscontext.RefFSContextFactory java.naming.provider.url=file:../server/default/deploy/external-fs.sar/META-INF </attribute> <attribute name="InitialContext">javax.naming.InitialContext</attribute> <attribute name="RemoteAccess">false</attribute> </mbean> </server> 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 il.jar 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.
Jacob