7 Replies Latest reply on Feb 4, 2009 6:12 AM by jaikiran

    JBoss 4.2 Context.xml docBase ignored?

    xnuandax

      Hi all,

      We would like to deploy a web context with path "/adad". To do this we placed a directory adad.war/ in jboss/server/default/deploy/, which deployed fine. However we want this web context to serve actual files from elsewhere, as can be done in Tomcat using docBase. To do this we created a "context.xml" file in the WEB-INF directory of "adad.war", as follows:

      <?xml version="1.0"?>
      <Context docBase="/srv/images" debug="99" reloadable="true" override="true">
      </Context>


      We know JBoss is parsing this context.xml file, as it honours certain attributes. However it never honours the "docBase" instruction, preferring instead to map "localhost:8080/adad/" to the directory inside "adad.war/", instead of the directory "/srv/images" that it is being instructed to serve from...

      Any ideas on how to make JBoss-web serve static content files from a docBase elsewhere on the filesystem would be much appreciated!

      Many Thanks,

      Dave


        • 1. Re: JBoss 4.2 Context.xml docBase ignored?
          kuvera

          In default/conf/jboss-service.xml towards the end you find DeploymentScanner settings. Change the URLs attribute:

           <attribute name="URLs">
           deploy/,file:/srv/images/
           </attribute>
          

          If there's a slash at the end, the directory is treated like deploy, and all subdirectories are deployed by default. But you can also specify adad.war at the end, without slash, and then only that one app. is deployed.
          (I don't know if "file:" is always needed or not, I use it for individual wars and ears. In the above case it may be just the path.)

          • 2. Re: JBoss 4.2 Context.xml docBase ignored?
            jeffgao

            We still didn't solve the problem: context.xml ignored.

            This one only add another local directory as deploy directory.

            I still have the problem with "context docbase ignored". Anyone know how to solve this problem.

            • 3. Re: JBoss 4.2 Context.xml docBase ignored?
              peterj

              jeffgoa - PLEASE STOP POSTING your problem to every forum post that mentions external directories!!!

              • 4. Re: JBoss 4.2 Context.xml docBase ignored?
                jeffgao

                Peter, sorry!
                b
                It seems that "modifying server.xml Context entry, adding docBase" works. The key on Windows is to add "c:\" before directory.

                Jeff

                • 5. Re: JBoss 4.2 Context.xml docBase ignored?
                  plewright

                  Does docBase work in context.xml that goes inside the ear? Not good to use the server.xml as that would be too invasive so is not preferred. We need to be able to hot-deploy these docBase changes - and not restart the whole server just for that.

                  • 6. Re: JBoss 4.2 Context.xml docBase ignored?

                    This is absolutely ridiculous. Absurd. I have to edit a server XML file just to deploy an application that does not live in the JBOSS directory tree. Everytime a new JBoss comes out, I have to re-edit the same or a different XML file. BS. I need to be able to run "ant deploy" and have my CONTEXT.XML copied to the right place (hopefully JBOSS/deploy).

                    • 7. Re: JBoss 4.2 Context.xml docBase ignored?
                      jaikiran

                       

                      This is absolutely ridiculous. Absurd. I have to edit a server XML file just to deploy an application that does not live in the JBOSS directory tree.


                      Which xml file are you referring to? I'm confused because of your next statement:

                      I need to be able to run "ant deploy" and have my CONTEXT.XML copied to the right place