java.lang.StringIndexOutOfBoundsException: String index out of range: -1 error when using a Web module welcome page
 Technote (FAQ)
 
Problem
When accessing the welcome page for a Web module you get the following error in the Web browser:

An unexpected internal error has occurred
com.ibm.servlet.engine.srt.InternalServerError:
Internal Server Error
at com.ibm.servlet.engine.srt.WebGroup.getInternalServerErrorTarget
at com.ibm.servlet.engine.srt.WebGroup.getTargetByURI
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest
at com.ibm.ws.http.HttpConnection.readAndHandleRequest
at com.ibm.ws.http.HttpConnection.run
at com.ibm.ws.util.CachedThread.run

Root Cause
java.lang.StringIndexOutOfBoundsException: String index out of range: -1
at java.lang.String.substring
at java.lang.String.substring
at com.ibm.servlet.engine.srt.WebGroup.getTargetByURI
at com.ibm.servlet.engine.srp.ServletRequestProcessor.dispatchByURI
at com.ibm.servlet.engine.oselistener.OSEListenerDispatcher.service
at com.ibm.servlet.engine.http11.HttpConnection.handleRequest
at com.ibm.ws.http.HttpConnection.readAndHandleRequest
at com.ibm.ws.http.HttpConnection.run
at com.ibm.ws.util.CachedThread.run
 
Cause
This error occurs when trying to access the welcome page of a Web module that has an invalid context root. Consider the following example.
 
Solution
A welcome page is defined so that when you request the URL http://YourServerName/test it brings up http://YourServerName/test/welcome.html. "/test" would be the context root of the web module.

However, when you request http://YourServerName/test, the error above occurs. The reason for this is that the context root for the web module is defined as "/test/".

The context root for a web module should not end in a "/". Simply define the context root as "/test" and the problem will be resolved.

 
 
 


Document Information


Product categories: Software > Application Servers > Distributed Application & Web Servers > WebSphere Application Server > Servlet Engine/Web Container
Operating system(s): HP-UX
Software version: 4.0
Software edition:
Reference #: 1055374
IBM Group: Software Group
Modified date: Feb 18, 2005