4 Replies Latest reply on Mar 1, 2005 7:10 AM by Erik Turesson

    IndexOutOfBoundException with jsp:include chain

    Erik Turesson Novice

      Hello!

      I am running Jboss, both 3.2.5 with jetty and 3.26 with tomcat.

      In some of my jsp pages I have a chain of jsp:include, i.e one jsp does include on another jsp that does include on yet another jsp.

      This works fine in 3.2.5 with jetty but fails in 3.2.6 with tomcat. In tomcat I am receiving an IndexOutOfBoundsException at the jsp:include row. I do jsp:include with flush="false". If I change it to flush="true" it gets a little better, the page is rendered a bit further but it still generates a IndexOutOfBoundsException.

      Why am I receiving this exception in tomcat and not in jetty?
      What shall I do to fix this?

      /Erik

        • 1. Re: IndexOutOfBoundException with jsp:include chain
          Erik Turesson Novice

          Hello!

          This is the stacktrace that is printed out.

          /Erik

          2005-02-28 18:10:49,039 ERROR [org.jboss.web.localhost.Engine] StandardContext[]Error during mapping
          java.lang.StringIndexOutOfBoundsException: String index out of range: -48
          at java.lang.String.getChars(String.java:724)
          at org.apache.tomcat.util.buf.CharChunk.append(CharChunk.java:353)
          at org.apache.catalina.core.ApplicationContext.getRequestDispatcher(ApplicationContext.java:432)
          at org.apache.catalina.core.ApplicationContextFacade.getRequestDispatcher(ApplicationContextFacade.java:196)
          at org.apache.catalina.core.ApplicationHttpRequest.getRequestDispatcher(ApplicationHttpRequest.java:298)
          at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:964)
          at org.apache.jsp._121_jsp._jspService(_121_jsp.java:211)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
          at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
          at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:510)
          at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
          at com.joodit.page.misc.joodit_jsp._jspService(joodit_jsp.java:188)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at com.joodit.jsp.filters.StatisticsFilter.doFilter(StatisticsFilter.java:33)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at com.joodit.jsp.filters.ErrorFilter.doFilter(ErrorFilter.java:34)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(Unknown Source)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(Unknown Source)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Unknown Source)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
          at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
          at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
          at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
          at java.lang.Thread.run(Thread.java:595)
          2005-02-28 18:10:49,069 ERROR [org.jboss.web.localhost.Engine] ApplicationDispatcher[] Servlet.service() for servlet jsp threw exception
          java.lang.NullPointerException
          at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
          at org.apache.jsp._121_jsp._jspService(_121_jsp.java:211)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
          at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
          at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
          at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
          at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:510)
          at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
          at com.joodit.page.misc.joodit_jsp._jspService(joodit_jsp.java:188)
          at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
          at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at com.joodit.jsp.filters.StatisticsFilter.doFilter(StatisticsFilter.java:33)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at com.joodit.jsp.filters.ErrorFilter.doFilter(ErrorFilter.java:34)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(Unknown Source)
          at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
          at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(Unknown Source)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Unknown Source)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
          at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
          at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
          at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
          at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
          at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
          at java.lang.Thread.run(Thread.java:595)
          2005-02-28 18:10:49,089 INFO [STDOUT] Site = ssd
          Unknown exception class java.lang.NullPointerException java.lang.NullPointerException
          2005-02-28 18:10:49,089 INFO [STDOUT] java.lang.NullPointerException
          2005-02-28 18:10:49,089 INFO [STDOUT] at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
          2005-02-28 18:10:49,089 INFO [STDOUT] at org.apache.jsp._121_jsp._jspService(_121_jsp.java:211)
          2005-02-28 18:10:49,089 INFO [STDOUT] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
          2005-02-28 18:10:49,089 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:325)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:295)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:245)
          2005-02-28 18:10:49,099 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:590)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:510)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.jasper.runtime.JspRuntimeLibrary.include(JspRuntimeLibrary.java:966)
          2005-02-28 18:10:49,099 INFO [STDOUT] at com.joodit.page.misc.joodit_jsp._jspService(joodit_jsp.java:188)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:99)
          2005-02-28 18:10:49,099 INFO [STDOUT] at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          2005-02-28 18:10:49,099 INFO [STDOUT] at com.joodit.jsp.filters.StatisticsFilter.doFilter(StatisticsFilter.java:33)
          2005-02-28 18:10:49,099 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          2005-02-28 18:10:49,110 INFO [STDOUT] at com.joodit.jsp.filters.ErrorFilter.doFilter(ErrorFilter.java:34)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(Unknown Source)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
          2005-02-28 18:10:49,110 INFO [STDOUT] at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(Unknown Source)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(Unknown Source)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
          2005-02-28 18:10:49,120 INFO [STDOUT] at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
          2005-02-28 18:10:49,130 INFO [STDOUT] at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
          2005-02-28 18:10:49,130 INFO [STDOUT] at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
          2005-02-28 18:10:49,130 INFO [STDOUT] at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
          2005-02-28 18:10:49,130 INFO [STDOUT] at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
          2005-02-28 18:10:49,130 INFO [STDOUT] at java.lang.Thread.run(Thread.java:595)

          • 2. Re: IndexOutOfBoundException with jsp:include chain
            Erik Turesson Novice

            Hello!

            After a bit more digging I have downloaded Jboss 4.01.
            The problem still remains usion the Tomcat bundled.
            But after downloading Jetty 5.1.2 for Jboss 4.0. The problem disapears.
            My conclution is therefor that it must be something in Tomcat that causes the error. But I can not find out what.

            Somebody that can?

            /Erik

            • 3. Re: IndexOutOfBoundException with jsp:include chain
              Anil Saldanha Master

              Create a JIRA issue at http://jira.jboss.org

              Provide a test war that shows this behavior.

              • 4. Re: IndexOutOfBoundException with jsp:include chain
                Erik Turesson Novice

                Hello!

                Now I have found the cause of my problem.
                It is nothing with jsp:include-chains. The problem is caused by a url containing an argument with a ";" in it.

                This jsp:include succeeds

                <jsp:include page="test.jsp?p=something" flush="false" />

                but this one fails

                <jsp:include page="test.jsp?p=something;" flush="false" />

                Is´nt it allowed to have ";" in the parameterstring?

                /Erik