4 Replies Latest reply on Aug 26, 2003 2:16 PM by mtb2ride

    jboss-web.xml in an .ear

    ggregd

      I have a war (myApp.war) file deployed inside an .ear file (myApp.ear which has my DAO's). I have a very basic jboss-web.xml in my .war file's WEB-INF directory which consists of:

      <?xml version="1.0" encoding="ISO-8859-1" ?>

      <jboss-web>
      <context-root>/</context-root>
      </jboss-web>

      but it doesn't seem to be doing anything. If I go to http://localhost:8080 I get a "no context configured" error. http://localhost:8080/myApp loads just fine. No errors occur on startup.

      Any assistance is appreciated.

      Greg

        • 1. Re: jboss-web.xml in an .ear
          ggregd

          I figured it out. You've been very helpful.

          OK, fine, I'll spill for the next person. My .ear's application.xml file had the following content:



          <web-uri>myApp.war</web-uri>
          <context-root>/myApp</context-root>



          Which was overriding jboss-web.xml, so I removed the <context-root> element and viola.

          Except that wherever I had a servlet URI in my JSP (an image from disk file loader and chart generators) I had to change the page code from



          to



          Which unless I'm missing something seems like a ding against portability to me - if anyone wants to use the context they need a different set of JSP's.

          Greg

          • 2. Re: jboss-web.xml in an .ear
            mtb2ride

            Greg,

            There are ways to keep from having to change the SRC paths in you Jsps when your web context-root changes.

            The best way is to set the html elment

            Struts has a tag (<html:base/>) that sets the for you according to where your jsp file is. In your case using <html:base/> would have given you portability.

            Steve

            • 3. Re: jboss-web.xml in an .ear
              twutort

              Hello,

              I have a question that is similar to this. I'm doing a very large port from another server. In order to avoid changing thousands of JSPs I'd like for my include files to pick up from the same directory. However, when I set the following I still have to add wwwroot to my include path:

              <context-root>/wwwroot</context-root>


              I have to make my include lines in the jsp as follows:

              <%@ include file="/wwwroot/includes_jsp/ADMIN/sniffer.shtml" %>

              Is there any setting I can make so my include line looks like this:

              <%@ include file="/includes_jsp/ADMIN/sniffer.shtml" %>

              Thanks,
              Tim

              • 4. Re: jboss-web.xml in an .ear
                mtb2ride

                Tim,

                If your JSPs are laid out in a more flat structure i.e. most of the JSPs are in the same directory, it'd be easy to just use a relative path on your include directive.

                example:

                If the relative path to the sniffer.shtml is ../../includes_jsp/ADMIN/sniffer.jsp then use

                <%@ include file="../../includes_jsp/ADMIN/sniffer.shtml" %>

                But, if you have a deep jsp structure, this would probably be tough to do without automating it. With thousands of Jsps, I'd write a search and replace in perl that could compute what your relative directoy pattern is and then apply it to each include directive.

                Thanks
                Steve