7 Replies Latest reply on Jul 24, 2008 10:38 PM by david.bennett

    external directories - serving static content - jboss 4.2.x

    david.bennett

      Hopefully someone has had a similar problem and found a solution. I have seen numerous posts and pages relating to this problem. My specific case.

      currently migrating from jboss 4.0.5 to 4.2.x, started on 4.2.2, now moved to 4.2.3 with jdk6 support.

      I had an external directory setup in 4.0.5 serving image files from

      C:\developmentnewides\ApecsSystem\Resources\webresources

      this was setup in {jbosshome}\deploy\jbossweb-tomcat55.sar\server.xml as



      which is consistent with the solutions found. This works fine on the current release version using 4.0.5

      In 4.2.x on server startup, I get the message "00:02:49,459 WARN [config] Unable to process deployment descriptor for context '/ApecsResources'"

      not too helpful. I tried changing the context docbase to an absolute file path .. same problem.
      I then looked at the server.log for more info and it lists the following when trying to setup the external directory:

      2008-07-24 00:02:49,181 INFO [org.apache.catalina.core.StandardService] Starting service jboss.web
      2008-07-24 00:02:49,183 INFO [org.apache.catalina.core.StandardEngine] Starting Servlet Engine: JBossWeb/2.0.1.GA
      2008-07-24 00:02:49,424 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] ConfigureListener.contextInitialized(/ApecsResources)
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.displayConfiguration' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.validateXml' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.verifyObjects' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.forceLoadConfiguration' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.enableHtmlTagLibValidator' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.preferXHTML' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.compressViewState' - ENABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.compressJavaScript' - ENABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.externalizeJavaScript' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.sendPoweredByHeader' - ENABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.enableJSStyleHiding' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.enableScriptsInAttributeValues' - ENABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.writeStateAtFormEnd' - ENABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.enableLazyBeanValidation' - ENABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.enabledLoadBundle11Compatibility' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.enableRestoreView11Compatibility' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.serializeServerState' - DISABLED
      2008-07-24 00:02:49,431 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.enableViewStateIdRendering' - ENABLED
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.registerConverterPropertyEditors' - DISABLED
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.disableUnicodeEscaping' - DISABLED
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1021: [/ApecsResources] Configuration option 'com.sun.faces.developmentMode' - DISABLED
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/ApecsResources] Configuration option 'javax.faces.STATE_SAVING_METHOD' set to 'server'
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/ApecsResources] Configuration option 'javax.faces.DEFAULT_SUFFIX' set to '.jsp'
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/ApecsResources] Configuration option 'com.sun.faces.numberOfViewsInSession' set to '15'
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/ApecsResources] Configuration option 'com.sun.faces.numberOfLogicalViews' set to '15'
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/ApecsResources] Configuration option 'com.sun.faces.injectionProvider' set to 'org.jboss.web.jsf.integration.injection.JBossInjectionProvider'
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/ApecsResources] Configuration option 'com.sun.faces.responseBufferSize' set to '1024'
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/ApecsResources] Configuration option 'com.sun.faces.clientStateWriteBufferSize' set to '8192'
      2008-07-24 00:02:49,432 DEBUG [javax.enterprise.resource.webcontainer.jsf.config] JSF1018: [/ApecsResources] Configuration option 'com.sun.faces.expressionFactory' set to 'com.sun.el.ExpressionFactoryImpl'
      2008-07-24 00:02:49,459 WARN [javax.enterprise.resource.webcontainer.jsf.config] Unable to process deployment descriptor for context '/ApecsResources'

      so, i dont know what jsf has to do with external directories, but looks as though it has an issue here, i think.

      I then tried to remove jsf support from jboss from info found on another website. This appeared to remove jsf, however, jboss no longer attempted to setup the external directory and it was not available when i tried to access it via the url

      http://localhost/ApecsResources (yes I am using port 80).

      I have no idea what is causing the problem and would appreciate any help, advise, suggestions, etc.

      thanks,
      dave.

        • 1. Re: external directories - serving static content - jboss 4.
          peterj

          Please repost the server.xml entry, and use the Code button to bracket it in [ code ] tags, and use the Preview button to verify that the formatting is correct (and the text appears) before posting.

          Ignore the JSF stuff, it has nothing to do with the external directory, especially since external directories handle only static content.

          External directories worked for me just fine on 4.2.2, haven't tired them on 4.2.3 yet.

          • 2. Re: external directories - serving static content - jboss 4.
            david.bennett

            HI Peter,
            here is the relevant portion of web.xml.


            ...

            <Valve className="org.jboss.web.tomcat.service.jca.CachedConnectionValve" cachedConnectionManagerObjectName="jboss.jca:service=CachedConnectionManager" transactionManagerObjectName="jboss:service=TransactionManager"/>
             <Context docBase="..\..\..\Resources\webresources" path="/ApecsResources"/>
            
            
             </Host>


            • 3. Re: external directories - serving static content - jboss 4.
              peterj

              Relative paths are relative to jboss_home/bin.

              Are you getting an error that looks like this:

              07:52:38,569 ERROR [StandardContext] Error starting static Resources
              java.lang.IllegalArgumentException: Document base D:\temp\static does not exist or is not a readable directory

              If not, then the static directory should be available.

              Here is my setup:

              <Context path="/tryit"
               docBase="d:/temp/static">
               </Context>
              
              </Host>


              I can access a page via http://localhost:8080/tryit/index.html


              • 4. Re: external directories - serving static content - jboss 4.
                david.bennett

                HI,
                as I understand it, relative paths are relative to

                {jboss.home.dir}

                the relative path I have is correct and worked in 4.0.5

                I have tried an absolute path to c:/temp/images, still doesnt work.

                I dont see the error below, the one I get is

                23:03:35,537 WARN [config] Unable to process deployment descriptor for context '/images'


                If I change to a non-existant directory I get something a similar if not the same error as below.

                For now I think, I will have to give up on this and move the directories to the webserver root, which I dont want to do as it distributes the application files to multiple locations, however, no more time can be wasted on this common but unsolved (for many) problem.

                • 5. Re: external directories - serving static content - jboss 4.
                  david.bennett

                  UPDATE...SOLUTION FOUND

                  Being the persistent SOB that I am, I have finally found a solution (at least in my case).

                  Hopefully the same solution will work for others having this very annoying problem.

                  The solution was to install the apache portable runtimes for jboss. These are the optimized runtimes for http transfers so you should have them installed anyway (they are not part of the Jboss AS download).

                  you can try the instructions at http://wiki.jboss.org/wiki/HowToAddAprToJBoss

                  but the locations/files dont seem to match.

                  I downloaded the APR from http://www.jboss.org/jbossweb/downloads/jboss-native/
                  opened up the zip file and extracted the contents into {jboss.home}, not bin/native as some guides specify.

                  I restarted the server and viola, it works.

                  So for anyone starting from scratch -
                  1. install Jboss 4.2.x and jdk
                  2. install the Apache Portable Runtime (APR) or jboss native from http://www.jboss.org/jbossweb/downloads/jboss-native/
                  3. edit your {jboss.home}/server/default/deploy/jboss-web.deployer/server.xml file and add a context (inside the host tag) to the external directory, i.e.

                  <Context docBase="c:/temp/images "/images"/>




                  4. start server and test.

                  SPECIAL NOTE: Jboss 4.2.x doesnt appear to support directory listings in the standard config like 4.0.x so if you were to try the url

                  http://localhost/images

                  you will get a 404 error unless there is an index.html in that directory. To test try-

                  http://localhost/images/testimage.jpg
                  where testimage.jpg is a image file you have put in the directory.

                  • 6. Re: external directories - serving static content - jboss 4.
                    david.bennett

                    sorry typo in last post, for step 3 the example should be

                    3. edit your {jboss.home}/server/default/deploy/jboss-web.deployer/server.xml file and add a context (inside the host tag) to the external directory, i.e.


                    • 7. Re: external directories - serving static content - jboss 4.
                      david.bennett

                      damn this forum ..

                      sorry typo in last post, for step 3 the example should be

                      3. edit your {jboss.home}/server/default/deploy/jboss-web.deployer/server.xml file and add a context (inside the host tag) to the external directory, i.e.

                      <Context docBase="C:/temp/images" path="/images"/>