11 Replies Latest reply on Mar 11, 2010 10:37 AM by rossog

    External Directories On JBoss 4.2.x

    nhelder

      Hi, all~

      So, after a fair bit of searching, it appears the question of how to set up external directories (aka "virtual" or "static" directories) has been asked quite a few times, and answered at least a few. One of the more popular answers is here:
      http://www.jboss.org/?module=bb&op=viewtopic&p=3829886

      There's even a Wiki:
      http://wiki.jboss.org/wiki/Wiki.jsp?page=ExternalDirectories

      However, none the solutions I've come across appear to work with with the latest JBoss builds (I've tried most all of them on a fresh install of 4.2.1 without any luck).

      So, my question: has anyone been able to set up a external directory to be served by JBoss 4.2.x? If so, what did you do?

      Otherwise, perhaps you have an idea as to how this could be done and pass that along?

      Thanks in advance for your help,

      - Nathan

        • 1. Re: External Directories On JBoss 4.2.x
          mdiamant

          Hello nhelder,

          Your post is dated from August 2007, so I do not know if you are still facing this problem. I am new to JBoss AS myself and like you, I was trying to figure out how to use virtual directories in JBoss AS and I had stumbled upon the same posts as you.

          Using JBoss AS v4.2.2.GA I have successfully employed virtual directories (external directories in the JBoss nomenclature). I followed the steps provided in the external directories wiki page (http://wiki.jboss.org/wiki/Wiki.jsp?page=ExternalDirectories), but skipped copying the default web.xml file. In order to get external directories to work, I had to include the path parameter in the context tag. Originally, I had copied over a working context tag from a standalone version of Apache Tomcat v5.5, which did not include the parameter, path. It was the addition of the path tag that made the external directories work.

          I hope this helps if you are still trying to use external directories in JBoss AS 4.2.x

          Best,
          Michael

          • 2. Re: External Directories On JBoss 4.2.x
            nhelder

            Hi, Michael~

            Thanks for your post. I had given up on getting external directories to work via JBoss, and instead went the route of putting an Apache install in front of the JBoss servers to expose those couple folders I was wanting to make available to the corporate machines on our intranet.

            But, it would of course be preferable to have one less step in the install process, so I am interested to hear that you got things to work.

            Before I make the attempt, could you provide some additional details of your setup? - What is the path to your JBoss install? What is the path to the directory you made externally visible? And what was the context element you added to your server.xml file?

            Thanks in advance,

            - Nathan

            • 3. Re: External Directories On JBoss 4.2.x
              mdiamant

              JBoss install: C:\jboss-4.2.2.GA
              External directory made visible: C:\DI_Solution\webapps\NetDiver
              Context element from server.xml:

              <Context path="/NetDiver" docBase="C:\DI_Solution\webapps\NetDiver\netdiver-61.war" unpackWAR="false">
               <Parameter name="netdiver.dataroot" value="C:\DI_Solution\webdata\NetDiver" />
               <Parameter name="diveline.server" value="localhost:2130" />
               <Parameter name="diveline.allow-server-change" value="true" />
               </Context>
              

              Hope this helps!

              -Michael

              • 4. Re: External Directories On JBoss 4.2.x
                jeffgao

                Michale,

                I tried on my Jboss 4.3, it doesn't work.




                In my c:/images directory, I only have a few image files.

                I hope to see http://localhost/images, but I did not.

                Jeff

                • 5. Re: External Directories On JBoss 4.2.x
                  josephs70

                  Was able to setup external directory on JBoss-4.2.3

                  I changed server.xml in

                  %JOSS_HOME%/server/XXX/deploy/jboss-web.deployer/server.xml

                  and works as expected.

                  http://josephs70.blogspot.com/2008/09/jboss-42x-setup-virtual-directory-setup.html

                  • 6. Re: External Directories On JBoss 4.2.x
                    ajay662

                    I am seeing the same issue after upgrading my application to jboss 4.2.3. The external directory configuration was working fine on jboss 4.0.5. In jboss 4.2.3 I see the error:

                    13:36:32,476 WARN [config] Unable to process deployment descriptor for context '/releases'


                    My configuration in server.xml looks like this:

                     <Context path="/releases" appBase=""
                     docBase="${jboss.server.home.dir}/enmsdata/releases">
                     </Context>


                    What do you need to do to make it work with jboss 4.2.3. Do you need jbossweb native connectors?

                    Thanks.

                    • 7. Re: External Directories On JBoss 4.2.x
                      peterj

                      I do not think that the warning means that there is a problem. If you have a static file in ${jboss.server.home.dir}/enmsdata/releases, then your should be able to access it using the release context. Example, given the file:

                      ${jboss.server.home.dir}/enmsdata/releases/someimage.png

                      You should be able to access it using the URL:

                      http://localhost:8080/release/someimage.png

                      • 8. Re: External Directories On JBoss 4.2.x
                        peterj

                        And to answer your other question - no you do not need JBoss Native to support external directories.

                        • 9. Re: External Directories On JBoss 4.2.x
                          ajay662

                          Yes, worked. Thanks.

                          Couple of user errors on my part. First I was trying to list the contents of the directory... which looks like doesn't work because of the security. Secondly since the default binding (to interfaces) behavior changed with 4.2, my web-server was not bound on the interface on which I was trying. After I took care of these 2 issues, it works just fine.

                          Thanks for your quick help!!

                          • 10. Re: External Directories On JBoss 4.2.x
                            vladimiralbis

                            Hi to all and thanks for your replies. My question is: can i add access restrictions to virtual directories?. I was reading different posts and no luck about this, is it possible to use and my own class?. This virtual folders contains images, but my application requieres these resources to be restricted.

                            Again thanks,
                            Vladimir

                            • 11. Re: External Directories On JBoss 4.2.x
                              rossog

                              I think there's still something missing.

                              JBoss 4.2.3

                              I had a context.xml in a webapp, placed inside WEB-INF (in META-INF doesn't work). I defined a Valve to make logs, and it works (just to see if context.xml was read).

                              Here's the problem: I have a NFS share, let's say /usr/local/documents, filled with static docs, pdf, html and txt. A webapp, deployed under /mywebapp, has links to access static documents as /mywebapp/history. Is there a way to map /mywebapp/history to /usr/local/documents?

                              I tryed the following:

                              <Context override='true' path='/history/' docBase='/usr/local/documents/'>

                              but trying to access this path results in a 404 error.

                              I also tryed:

                              <Context override='true' path='/mywebapp/history/' docBase='/usr/local/documents/'>

                              but didn't work as well.

                              Is there a solution to solve this problem?

                              Thanks.