4 Replies Latest reply on Aug 22, 2006 5:55 AM by harryco

    crossContext does not work on jboss4.02-rc1-tomcat-5.5.8

    sdhaliwal

      We are using jboss4.0.2-rc1 and want to be able to dispatch to jsps in different web application. Our configuration is as follows :
      jbossweb-tomcat55.sar/server.xml file has the following attributes set



      jbossweb-tomcat55.sar/context.xml is as follows

      <!-- The contents of this file will be loaded for each web application -->




      In a servlet, we do the following :


      ServletContext servletContext = getServletContext();
      ServletContext otherContext = servletContext.getContext("/http-bridge");

      The otherContext above is always null. The same code works fine on
      jboss4.0.1-sp1-tomcat-5.0.30.

      This creates a problem when we try to deploy jbossportal-2.0 beta on this version of jboss as the portal does the exact same call in the
      CoreServlet and throws a null pointer exception.

      It is highly desirable for us to use the above versions of jboss and jbossprotal but can't make a decision because the portal does not even come. Any suggestions/advice will be greatly appreciated

        • 1. Re: crossContext does not work on jboss4.02-rc1-tomcat-5.5.8
          kblythe

          I too experienced this problem.

          My workaround was to copy jbossweb-tomcat55.sar/context.xml to the WEB-INF directory for all webapps that need crossContext=true.

          • 2. Re: crossContext does not work on jboss4.02-rc1-tomcat-5.5.8
            starksm64

            All war specific context info needs to be set via the WEB-INF/context.xml descriptor. We do not support context info from the server.xml since war deployments are dynamic entities. Tomcat itself has deprecated the user of the Context settings from the server.xml.

            • 3. Re: crossContext does not work on jboss4.02-rc1-tomcat-5.5.8

              Thanks for the workaround, that worked for me as well. It seems as though you only need the context.xml in the WEB-INF of the webapp you're getting the ServletContext from, not the one to which you're going to. For example, if I am in webapp context1 trying to forward to context2 with getServletContext().getContext("/context2").getRequestDispatcher("/myServletPath"), you only need the context.xml in the war file for context1. I found that a little surprising...

              • 4. Re: crossContext does not work on jboss4.02-rc1-tomcat-5.5.8
                harryco

                Hi ,

                I'm facing this problem also.
                What are the requirements to get this work. It's clearly stated in the javadoc of javax.servlet.ServletContext that calling ServletContext.getContext(String uri) must return the context of the wanted uri; (not the root context) or nul if some security policy was defined.

                I've tried puting context.xml in my calling war WEB-INF/. But still wont work.

                Any suggestion would be appreciated.

                TIA.

                Harry