2 Replies Latest reply on Mar 4, 2003 2:51 AM by pebal

    String out of range

    acasari

      Hi, anyone knows what this error means? The servlet was working with Jboss/Tomcat, but with JbosssWeb I get this error. Thanks in advance.

      16:35:18,407 WARN [jbossweb] WARNING: Exception for /hello/HelloWorldServlet
      org.apache.jasper.JasperException: No output directory: String index out of range: -1
      at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:536)

        • 1. Re: String out of range
          pebal

          Hi,
          I've got the same problem, and haven't solved it yet!
          I guess it is the JSP to Servlet creation and compilation, but I'm not sure.
          The files are working on a weblogic training setup.
          server.log:
          ...
          2003-02-14 15:02:37,631 INFO [org.jboss.deployment.MainDeployer] Deployed package: file:/F:/JAVA/jboss-3.0.4/server/all/deploy/j2eeanvendelseejb.jar
          2003-02-14 15:05:12,318 WARN [org.jboss.jbossweb] WARNING: Exception for /j2eeanvendelse/Calculate1.jsp
          org.apache.jasper.JasperException: No output directory: String index out of range: -1
          at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:536)
          at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176)
          ...

          Any ideas ?

          • 2. Re: String out of range
            pebal

            I've found a work-around:
            In web.xml add a terminating "/" in the "url-pattern" tokens, e.g. <url-pattern>/errorpage.jsp/</url-pattern>

            The problem is in JspServlet.java; loadJSP:
            if( outURI.endsWith("/") )
            outURI = outURI + jspUri.substring(1,jspUri.lastIndexOf("/")+1);
            else
            outURI = outURI + jspUri.substring(0,jspUri.lastIndexOf("/")+1);;
            The jspUri.lastIndexOf() causes the exception!
            I haven't gone further to find out why, and I don't know if the work-around is a good idea, - but it got me up and running!

            /Per