RE: Error loop for R - Tomcat 3.3.1a

2006-01-10 Thread Larry Isaacs
Sid,

The code where the exception is occurring is:

private final String getAbsolutePathRelativeToContext(String 
relativeUrlPath) {
String path = relativeUrlPath;

if (!path.startsWith(/)) {
String uri = (String) 
request.getAttribute(javax.servlet.include.servlet_path);
if (uri == null)
uri = ((HttpServletRequest) request).getServletPath();
401 String baseURI = uri.substring(0, uri.lastIndexOf('/'));
path = baseURI+'/'+path;
}

return path;
}

The code is trying to convert the weblmpagetop.jsp relative
path to a path from the root of the webapp.  What Jasper has to
work with to establish where weblmpagetop.jsp is located is
failing the uri.lastIndexOf('/').  This suggests the problem
is related to the forwards that are occurring prior to reaching
the include.  Perhaps there is something that needs to start with
a '/' that doesn't.

I can't say that this isn't due to a quirk, bug, or spec ambiguity,
as opposed the webapp doing something wrong with respect to
the Servlet 2.2 spec.  It sounds like you are stuck with 3.3.1
as is.  Hopefully a reasonable workaround can be found.

Cheers,
Larry
 

 -Original Message-
 From: Siddhartha Mehta [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 10, 2006 1:50 AM
 To: users@tomcat.apache.org
 Subject: Error loop for R - Tomcat 3.3.1a
 
   I am currently working on a web application that uses 
 Tomcat 4.1.27 and JDK 1.4.2_03.
 
 The same piece of code now needs to be supported on Tomcat 
 3.3.1 and JDK 1.4.2_08. I managed to get the classes, jsps 
 coompile and built by modifying the ant script. In fact even 
 the application runs perfect and the functionalities are 
 working as expected. Although, all is not good as it seems 
 so. In the backend, the tomcat - startup windows isn't quite 
 happy with the changes. I repeatedly get the following error 
 and I can make out very little from it.
 
 I can think of possible cause as this code in my jsp but not 
 really sure:
 
 
 jsp:include page=weblmpagetop.jsp flush=true
  jsp:param name=disable-session-validation value=true /
  jsp:param name=body-title-text value=%= title % /
  jsp:param name=body-location-text value=%= location 
 % / /jsp:include 
 
 Exception thrown in tomcat-start up window is below:
 
 2006-01-10 11:48:04 - Ctx(/WebLM) : Exception in R( /WebLM + 
 /weblmlogin.jsp + n
 ull) - javax.servlet.ServletException: String index out of range: -1
 at 
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
 textImpl.java:460)
 at com.avaya.weblm.weblmlogin._jspService(Unknown Source)
 at 
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at 
 org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
 :574)
 at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
 at org.apache.tomcat.core.Handler.service(Handler.java:235)
 at 
 org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
 85)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispa
 tcherImpl.java:272)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatc
 herImpl.java:174)
 at 
 com.avaya.weblm.WebLMServlet.forwardToNextPage(Unknown Source)
 at com.avaya.weblm.WebLMClientLogin.doPost(Unknown Source)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at 
 org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
 :574)
 at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
 at org.apache.tomcat.core.Handler.service(Handler.java:235)
 at 
 org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
 85)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispa
 tcherImpl.java:272)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatc
 herImpl.java:174)
 at 
 org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.jav
 a:423)
 at com.avaya.weblm.weblmlogin._jspService(Unknown Source)
 at 
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at 
 org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
 :574)
 at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
 at org.apache.tomcat.core.Handler.service(Handler.java:235)
 at 
 org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
 85)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispa
 tcherImpl.java:272)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatc

RE: Error loop for R - Tomcat 3.3.1a

2006-01-10 Thread Siddhartha Mehta
Hey Larry,
   
  Finally a refresh click brought a smile on my face :-)
   
  Yeah, it is one of those scenarios where people want backward support as 
against to moving forward.
   
  One thing that I dont understand is that the UIs are working very well. In 
fact I am able to change the password (that is when these exceptions are 
thrown) and is updated as well. Then why this backend exception. Any thoughts 
here?
   
  Also, there is a forward that is called before the include as you pointed 
out. Do you have any ideas on what tweaking I can try?
   
  Thanks again for your reply.
   
  Sid
   
  

Larry Isaacs [EMAIL PROTECTED] wrote:
  Sid,

The code where the exception is occurring is:

private final String getAbsolutePathRelativeToContext(String relativeUrlPath) {
String path = relativeUrlPath;

if (!path.startsWith(/)) {
String uri = (String) 
request.getAttribute(javax.servlet.include.servlet_path);
if (uri == null)
uri = ((HttpServletRequest) request).getServletPath();
401 String baseURI = uri.substring(0, uri.lastIndexOf('/'));
path = baseURI+'/'+path;
}

return path;
}

The code is trying to convert the weblmpagetop.jsp relative
path to a path from the root of the webapp. What Jasper has to
work with to establish where weblmpagetop.jsp is located is
failing the uri.lastIndexOf('/'). This suggests the problem
is related to the forwards that are occurring prior to reaching
the include. Perhaps there is something that needs to start with
a '/' that doesn't.

I can't say that this isn't due to a quirk, bug, or spec ambiguity,
as opposed the webapp doing something wrong with respect to
the Servlet 2.2 spec. It sounds like you are stuck with 3.3.1
as is. Hopefully a reasonable workaround can be found.

Cheers,
Larry


 -Original Message-
 From: Siddhartha Mehta [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 10, 2006 1:50 AM
 To: users@tomcat.apache.org
 Subject: Error loop for R - Tomcat 3.3.1a
 
 I am currently working on a web application that uses 
 Tomcat 4.1.27 and JDK 1.4.2_03.
 
 The same piece of code now needs to be supported on Tomcat 
 3.3.1 and JDK 1.4.2_08. I managed to get the classes, jsps 
 coompile and built by modifying the ant script. In fact even 
 the application runs perfect and the functionalities are 
 working as expected. Although, all is not good as it seems 
 so. In the backend, the tomcat - startup windows isn't quite 
 happy with the changes. I repeatedly get the following error 
 and I can make out very little from it.
 
 I can think of possible cause as this code in my jsp but not 
 really sure:
 
 
 
 
  name=body-title-text
  % name=body-location-text
 
 Exception thrown in tomcat-start up window is below:
 
 2006-01-10 11:48:04 - Ctx(/WebLM) : Exception in R( /WebLM + 
 /weblmlogin.jsp + n
 ull) - javax.servlet.ServletException: String index out of range: -1
 at 
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
 textImpl.java:460)
 at com.avaya.weblm.weblmlogin._jspService(Unknown Source)
 at 
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at 
 org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
 :574)
 at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
 at org.apache.tomcat.core.Handler.service(Handler.java:235)
 at 
 org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
 85)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispa
 tcherImpl.java:272)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatc
 herImpl.java:174)
 at 
 com.avaya.weblm.WebLMServlet.forwardToNextPage(Unknown Source)
 at com.avaya.weblm.WebLMClientLogin.doPost(Unknown Source)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at 
 org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
 :574)
 at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
 at org.apache.tomcat.core.Handler.service(Handler.java:235)
 at 
 org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
 85)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispa
 tcherImpl.java:272)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatc
 herImpl.java:174)
 at 
 org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.jav
 a:423)
 at com.avaya.weblm.weblmlogin._jspService(Unknown Source)
 at 
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
 at javax.servlet.http.HttpServlet.service(HttpServlet.java)
 at 
 org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
 :574)
 at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
 at org.apache.tomcat.core.Handler.service(Handler.java:235)
 at 
 org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
 85)
 at 
 org.apache.tomcat.facade.RequestDispatcherImpl.doForward

RE: Error loop for R - Tomcat 3.3.1a

2006-01-10 Thread Larry Isaacs
I'm afraid I don't have any simple guesses as to
what to change.  It appears there are multiple forwards
occurring and it may be the multiple that is the
root cause of this behavior.  You can experiment with
changes to see what happens, or try to run tomcat in
a debugger to see if you can determine what
((HttpServletRequest) request).getServletPath() is
returning and why it doesn't have the expected '/'.
If you want to try the latter, source for Tomcat 3.3.1
or 3.3.1.a can be found here:

http://archive.apache.org/dist/tomcat/tomcat-3/archive/

An alternative to debugging is to create a classes
directory under lib/container and extract the source
for PageContextImpl into the package appropriate
subdirectory.  Then add System.out.println()s, and
compile.  When Tomcat is run, the PageContextImpl under
classes will take precedence over the one in
jasper.jar, allowing you to gather clues.

HTH,
Larry


 -Original Message-
 From: Siddhartha Mehta [mailto:[EMAIL PROTECTED] 
 Sent: Tuesday, January 10, 2006 8:51 AM
 To: Tomcat Users List
 Subject: RE: Error loop for R - Tomcat 3.3.1a
 
 Hey Larry,

   Finally a refresh click brought a smile on my face :-)

   Yeah, it is one of those scenarios where people want 
 backward support as against to moving forward.

   One thing that I dont understand is that the UIs are 
 working very well. In fact I am able to change the password 
 (that is when these exceptions are thrown) and is updated as 
 well. Then why this backend exception. Any thoughts here?

   Also, there is a forward that is called before the 
 include as you pointed out. Do you have any ideas on what 
 tweaking I can try?

   Thanks again for your reply.

   Sid

   
 
 Larry Isaacs [EMAIL PROTECTED] wrote:
   Sid,
 
 The code where the exception is occurring is:
 
 private final String getAbsolutePathRelativeToContext(String 
 relativeUrlPath) { String path = relativeUrlPath;
 
 if (!path.startsWith(/)) {
 String uri = (String) 
 request.getAttribute(javax.servlet.include.servlet_path);
 if (uri == null)
 uri = ((HttpServletRequest) request).getServletPath();
 401 String baseURI = uri.substring(0, uri.lastIndexOf('/')); 
 path = baseURI+'/'+path; }
 
 return path;
 }
 
 The code is trying to convert the weblmpagetop.jsp relative 
 path to a path from the root of the webapp. What Jasper has 
 to work with to establish where weblmpagetop.jsp is located 
 is failing the uri.lastIndexOf('/'). This suggests the 
 problem is related to the forwards that are occurring prior 
 to reaching the include. Perhaps there is something that 
 needs to start with a '/' that doesn't.
 
 I can't say that this isn't due to a quirk, bug, or spec 
 ambiguity, as opposed the webapp doing something wrong with 
 respect to the Servlet 2.2 spec. It sounds like you are stuck 
 with 3.3.1 as is. Hopefully a reasonable workaround can be found.
 
 Cheers,
 Larry
 
 
  -Original Message-
  From: Siddhartha Mehta [mailto:[EMAIL PROTECTED]
  Sent: Tuesday, January 10, 2006 1:50 AM
  To: users@tomcat.apache.org
  Subject: Error loop for R - Tomcat 3.3.1a
  
  I am currently working on a web application that uses Tomcat 4.1.27 
  and JDK 1.4.2_03.
  
  The same piece of code now needs to be supported on Tomcat
  3.3.1 and JDK 1.4.2_08. I managed to get the classes, jsps coompile 
  and built by modifying the ant script. In fact even the application 
  runs perfect and the functionalities are working as expected. 
  Although, all is not good as it seems so. In the backend, 
 the tomcat - 
  startup windows isn't quite happy with the changes. I 
 repeatedly get 
  the following error and I can make out very little from it.
  
  I can think of possible cause as this code in my jsp but not really 
  sure:
  
  
  
  
   name=body-title-text
   % name=body-location-text
  
  Exception thrown in tomcat-start up window is below:
  
  2006-01-10 11:48:04 - Ctx(/WebLM) : Exception in R( /WebLM + 
  /weblmlogin.jsp + n
  ull) - javax.servlet.ServletException: String index out of 
 range: -1 
  at 
  
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
  textImpl.java:460)
  at com.avaya.weblm.weblmlogin._jspService(Unknown Source) at
  org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
  at javax.servlet.http.HttpServlet.service(HttpServlet.java)
  at
  
 org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
  :574)
  at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
  at org.apache.tomcat.core.Handler.service(Handler.java:235)
  at
  
 org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
  85)
  at
  
 org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispa
  tcherImpl.java:272)
  at
  
 org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatc
  herImpl.java:174)
  at
  com.avaya.weblm.WebLMServlet.forwardToNextPage(Unknown Source) at 
  com.avaya.weblm.WebLMClientLogin.doPost(Unknown Source

Error loop for R - Tomcat 3.3.1a

2006-01-09 Thread Siddhartha Mehta
  I am currently working on a web application that uses Tomcat 4.1.27 and JDK 
1.4.2_03.

The same piece of code now needs to be supported on Tomcat 3.3.1 and JDK 
1.4.2_08. I managed to get the classes, jsps coompile and built by modifying 
the ant script. In fact even the application runs perfect and the 
functionalities are working as expected. Although, all is not good as it seems 
so. In the backend, the tomcat - startup windows isn't quite happy with the 
changes. I repeatedly get the following error and I can make out very little 
from it.

I can think of possible cause as this code in my jsp but not really sure:


jsp:include page=weblmpagetop.jsp flush=true
 jsp:param name=disable-session-validation value=true /
 jsp:param name=body-title-text value=%= title % /
 jsp:param name=body-location-text value=%= location % /
/jsp:include


Exception thrown in tomcat-start up window is below:

2006-01-10 11:48:04 - Ctx(/WebLM) : Exception in R( /WebLM + /weblmlogin.jsp + n
ull) - javax.servlet.ServletException: String index out of range: -1
at org.apache.jasper.runtime.PageContextImpl.handlePageException(PageCon
textImpl.java:460)
at com.avaya.weblm.weblmlogin._jspService(Unknown Source)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
85)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispa
tcherImpl.java:272)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatc
herImpl.java:174)
at com.avaya.weblm.WebLMServlet.forwardToNextPage(Unknown Source)
at com.avaya.weblm.WebLMClientLogin.doPost(Unknown Source)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
85)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispa
tcherImpl.java:272)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatc
herImpl.java:174)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.jav
a:423)
at com.avaya.weblm.weblmlogin._jspService(Unknown Source)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
85)
at org.apache.tomcat.facade.RequestDispatcherImpl.doForward(RequestDispa
tcherImpl.java:272)
at org.apache.tomcat.facade.RequestDispatcherImpl.forward(RequestDispatc
herImpl.java:174)
at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.jav
a:423)
at com.avaya.weblm.index._jspService(Unknown Source)
at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:119)
at javax.servlet.http.HttpServlet.service(HttpServlet.java)
at org.apache.tomcat.facade.ServletHandler.doService(ServletHandler.java
:574)
at org.apache.tomcat.core.Handler.invoke(Handler.java:322)
at org.apache.tomcat.core.Handler.service(Handler.java:235)
at org.apache.tomcat.facade.ServletHandler.service(ServletHandler.java:4
85)
at org.apache.tomcat.core.ContextManager.internalService(ContextManager.
java:917)
at org.apache.tomcat.core.ContextManager.service(ContextManager.java:833
)
at org.apache.tomcat.modules.server.Http10Interceptor.processConnection(
Http10Interceptor.java:176)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:494)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:516)
at java.lang.Thread.run(Thread.java:534)
Root cause:
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring(String.java:1444)
at org.apache.jasper.runtime.PageContextImpl.getAbsolutePathRelativeToCo
ntext(PageContextImpl.java:401)
at org.apache.jasper.runtime.PageContextImpl.include(PageContextImpl.jav
a:411)
at