Topic
  • 3 replies
  • Latest Post - ‏2013-02-27T20:53:01Z by bergmark
SystemAdmin
SystemAdmin
590 Posts

Pinned topic Liberty profile with error-page tag in web.xml not working

‏2013-02-27T14:34:57Z |
Trying to do a simple jsp error page for my servlet. Same war file won't work in Liberty Profile, but does in full Websphere. Any ideas?
inside web.xml....
<error-page>
<exception-type>java.lang.Exception</exception-type>
<location>/jsp/error-500.jsp</location>
</error-page>

The jsp page is in my folder /src/main/webapp/jsp/error-500.jsp
when inside the war file it is at /jsp/error-500.jsp
Trying just a simple page such as below won't work.
<%@ page isErrorPage="true" %>
<html><body><%=exception.toString()%></body></html>

I get this error
================================
Error Page Exception

SRVE0260E: The server cannot use the error page specified for your application to handle the Original Exception printed below.
================================
inside server.xml i have the following features
jaxrs-1.1
jsp-2.2
servlet-3.0
  • bergmark
    bergmark
    42 Posts

    Re: Liberty profile with error-page tag in web.xml not working

    ‏2013-02-27T17:41:20Z  
    It appears that some kind of error occurred while dispatching to the error page. Rather than re-dispatching to an error page for the nested error the message you listed was displayed.

    In order to diagnose what went wrong, we will likely need the server log and possibly JSP & WebContainer trace if the log doesn't have a further hint. Helpful trace might be:
    com.ibm.ws.webcontainer.*=all:com.ibm.wsspi.webcontainer.*=all:com.ibm.ws.jsp=all

    If I had to guess, I would guess that for some reason the "exception" variable wasn't set for you despite the isErrorPage attribute being set to true leading to an NPE.
  • SystemAdmin
    SystemAdmin
    590 Posts

    Re: Liberty profile with error-page tag in web.xml not working

    ‏2013-02-27T18:48:31Z  
    • bergmark
    • ‏2013-02-27T17:41:20Z
    It appears that some kind of error occurred while dispatching to the error page. Rather than re-dispatching to an error page for the nested error the message you listed was displayed.

    In order to diagnose what went wrong, we will likely need the server log and possibly JSP & WebContainer trace if the log doesn't have a further hint. Helpful trace might be:
    com.ibm.ws.webcontainer.*=all:com.ibm.wsspi.webcontainer.*=all:com.ibm.ws.jsp=all

    If I had to guess, I would guess that for some reason the "exception" variable wasn't set for you despite the isErrorPage attribute being set to true leading to an NPE.
    Here is the exception being logged in messages.log
    2/27/13 13:43:24:887 EST 00000020 com.ibm.ws.webcontainer.webapp E Error Page Exception:
    rest-1.4
    /v1.4
    Error Page Exception
    com.ibm.ws.webcontainer.webapp.WebAppErrorReport: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3916)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:4450)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:867)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:252)
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:531)
    at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:439)
    at com.ibm.ws.threading.internal.Worker.run(Worker.java:421)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.StringBuffer.charAt(StringBuffer.java:162)
    at com.ibm.ws.jsp.translator.document.JspPageParser.processJspComment(JspPageParser.java:1100)
    at com.ibm.ws.jsp.translator.document.JspPageParser.processElement(JspPageParser.java:283)
    at com.ibm.ws.jsp.translator.document.JspPageParser.processJspSyntax(JspPageParser.java:234)
    at com.ibm.ws.jsp.translator.document.JspPageParser.parse(JspPageParser.java:164)
    at com.ibm.ws.jsp.translator.document.Jsp2Dom.getJspDocumentAsJspPage(Jsp2Dom.java:526)
    at com.ibm.ws.jsp.translator.document.Jsp2Dom.getJspDocument(Jsp2Dom.java:196)
    at com.ibm.ws.jsp.translator.JspTranslator.<init>(JspTranslator.java:73)
    at com.ibm.ws.jsp.translator.JspTranslatorFactory.createTranslator(JspTranslatorFactory.java:116)
    at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJsp(JspTranslatorUtil.java:266)
    at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJspAndCompile(JspTranslatorUtil.java:121)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:526)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:443)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:272)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.findWrapper(AbstractJSPExtensionProcessor.java:526)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.getServletWrapper(AbstractJSPExtensionProcessor.java:369)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:977)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1383)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:191)
    at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3871)
    ... 8 more
  • bergmark
    bergmark
    42 Posts

    Re: Liberty profile with error-page tag in web.xml not working

    ‏2013-02-27T20:53:01Z  
    Here is the exception being logged in messages.log
    2/27/13 13:43:24:887 EST 00000020 com.ibm.ws.webcontainer.webapp E Error Page Exception:
    rest-1.4
    /v1.4
    Error Page Exception
    com.ibm.ws.webcontainer.webapp.WebAppErrorReport: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3916)
    at com.ibm.ws.webcontainer.webapp.WebApp.handleException(WebApp.java:4450)
    at com.ibm.ws.webcontainer.servlet.CacheServletWrapper.handleRequest(CacheServletWrapper.java:80)
    at com.ibm.ws.webcontainer.WebContainer.handleRequest(WebContainer.java:867)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost$2.run(DynamicVirtualHost.java:252)
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink$TaskWrapper.run(HttpDispatcherLink.java:531)
    at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:439)
    at com.ibm.ws.threading.internal.Worker.run(Worker.java:421)
    at java.lang.Thread.run(Thread.java:662)
    Caused by: java.lang.StringIndexOutOfBoundsException: String index out of range: -1
    at java.lang.StringBuffer.charAt(StringBuffer.java:162)
    at com.ibm.ws.jsp.translator.document.JspPageParser.processJspComment(JspPageParser.java:1100)
    at com.ibm.ws.jsp.translator.document.JspPageParser.processElement(JspPageParser.java:283)
    at com.ibm.ws.jsp.translator.document.JspPageParser.processJspSyntax(JspPageParser.java:234)
    at com.ibm.ws.jsp.translator.document.JspPageParser.parse(JspPageParser.java:164)
    at com.ibm.ws.jsp.translator.document.Jsp2Dom.getJspDocumentAsJspPage(Jsp2Dom.java:526)
    at com.ibm.ws.jsp.translator.document.Jsp2Dom.getJspDocument(Jsp2Dom.java:196)
    at com.ibm.ws.jsp.translator.JspTranslator.<init>(JspTranslator.java:73)
    at com.ibm.ws.jsp.translator.JspTranslatorFactory.createTranslator(JspTranslatorFactory.java:116)
    at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJsp(JspTranslatorUtil.java:266)
    at com.ibm.ws.jsp.translator.utils.JspTranslatorUtil.translateJspAndCompile(JspTranslatorUtil.java:121)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.translateJsp(AbstractJSPExtensionServletWrapper.java:526)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper._checkForTranslation(AbstractJSPExtensionServletWrapper.java:443)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionServletWrapper.checkForTranslation(AbstractJSPExtensionServletWrapper.java:272)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.findWrapper(AbstractJSPExtensionProcessor.java:526)
    at com.ibm.ws.jsp.webcontainerext.AbstractJSPExtensionProcessor.getServletWrapper(AbstractJSPExtensionProcessor.java:369)
    at com.ibm.ws.webcontainer.filter.WebAppFilterManager.invokeFilters(WebAppFilterManager.java:977)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.dispatch(WebAppRequestDispatcher.java:1383)
    at com.ibm.ws.webcontainer.webapp.WebAppRequestDispatcher.forward(WebAppRequestDispatcher.java:191)
    at com.ibm.ws.webcontainer.webapp.WebApp.sendError(WebApp.java:3871)
    ... 8 more
    So that error appears to hint that its trying to parse a JSP comment, but fails because the comment is somehow malformed.

    The snippet you pasted earlier of your error page doesn't contain any JSP comments (They look like <%-- --%>).

    Can you attach your error page that is leading to this failure?