2 Replies Latest reply on Sep 18, 2003 2:00 PM by Chuck Harris

    Cannot load image in folder in war

    Chuck Harris Newbie

      I am migrating an application (one ear containing one war and 3 jars - one is an ejb)
      from jboss 2.4.1 tomcat 3.2.3 to jboss 3.2.2 tomcat 4.1.27 (package jboss-3.2.2RC3).
      The initial jsp page is displayed but the images and scripts are not retrieved
      from the war. The jsps are in the root of the war. There is an image directory
      and script directory and the files in those directories are not loaded.
      Application.xml located in meta-inf of the ear looks like:
      <application>
      <display-name>AFSP</display-name>
      <module>
      <web>
      <web-uri>afsp.war</web-uri>
      <context-root>/afsp</context-root>
      </web>
      </module>
      <module>
      <ejb>workflow.jar</ejb>
      </module>
      </application>

      I added a jboss-web to the web-inf of the war and have changed it many ways in response to reading many many posts.
      <jboss-web>
      <context-root>/</context-root> and
      <context-root>/images</context-root> and
      <context-root>images/</context-root> and
      <context-root></context-root> and
      <!-- <context-root></context-root> -->
      </jboss-web>
      How do I include the images and scripts? Do I have to have a separate file for each directory since the dtd only allows one context root? A different solution? Thanks.

      12:58:53,869 INFO [Engine] StandardHost[localhost]: MAPPING configuration error for request URI /js/date.js
      12:58:53,869 INFO [Engine] StandardHost[localhost]: MAPPING configuration error for request URI /js/date.js
      12:58:53,889 INFO [Engine] StandardHost[localhost]: MAPPING configuration error for request URI /js/sniffer.js
      12:58:53,889 INFO [Engine] StandardHost[localhost]: MAPPING configuration error for request URI /js/sniffer.js
      12:58:53,899 INFO [Engine] StandardHost[localhost]: MAPPING configuration error for request URI /images/spacer.gif
      12:58:53,899 INFO [Engine] StandardHost[localhost]: MAPPING configuration error for request URI /images/spacer.gif
      12:58:53,919 INFO [Engine] StandardHost[localhost]: MAPPING configuration error for request URI /images/banner.jpg
      12:58:53,919 INFO [Engine] StandardHost[localhost]: MAPPING configuration error for request URI /images/banner.jpg

        • 1. Re: Cannot load image in folder in war
          Jon Barnett Master

          I'm confused with your configuration. From what I can see, you have mapped a context root in the application.xml for /afsp. This means the WAR content should be located at http://localhost:8080/afsp. If your Javascript is in a subdirectory /js off the root of your WAR, then it would be located in http://localhost:8080/afsp/js.

          I'm not sure of the effect when you try to override that directive within the WAR, although I suspect the EAR directive takes precedence. I would recommend setting the context in one or the other, and not both and then experiment with the setting in one or the other.

          • 2. Re: Cannot load image in folder in war
            Chuck Harris Newbie

            Thanks for the help. I inherited this application so your comments about the structure of the war were very helpful. The page is now displaying correctly. I changed the context in application.xml to / and the context in jboss-web.xml to /afsp. I added an afsp dir to the war containing all of the jsp. Thanks again.