3 Replies Latest reply on Nov 8, 2007 6:10 AM by Dmitry Demyankov

    Null pointer exception on <jsp:include>

    Brian Parkinson Newbie

      Hello:

      Sorry for the barrage of questions today, but thanks to those helping out - it's super-appreciated.

      I am seeing a NPE when trying to <jsp:include> a file.

      My servlet mapping is:

      <servlet-mapping>
      <servlet-name>FacesServlet</servlet-name>
      <url-pattern>*.jsf</url-pattern>
      </servlet-mapping>

      and my JSF files are *.jsp - all is working fine except when I try an include. Here's the include part:



      <f:view>
      ...
      <jsp:include page="/include/example.jsf" />
      ...

      And the file (/include/example.jsp):

      <f:subview>
      <h:outputText value="TESTING" />
      </f:subview>

      The stack trace is below - it indicates an error on a line pretty far away from the <jsp:include> tag, so I'm stumped. If I change the include to be:

      <jsp:include page="/include/example.jsp" />

      then I get the contents of the file included in my page (with no error) but not processed.

      Any help is appreciated.

      Thanks.

      parki...



      org.apache.jasper.JasperException: An exception occurred processing JSP page /protected/main.jsp at line 50

      47: <rich:toolBar height="30" itemSeparator="line">
      48: <h:outputText value="#{i18n.app_name}" />
      49: <rich:toolBarGroup location="right">
      50: <h:commandButton action="#{visit.changeLocale}" title="submit" value="locale" />
      51: <h:commandButton action="#{authentication.logout}" title="submit" value="logout" />
      52: </rich:toolBarGroup>
      53: </rich:toolBar>


      Stacktrace:
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:518)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:411)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
      com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
      com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
      org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
      com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
      com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      com.avaning.webapp.servlet.AuthorizationFilter.doFilter(AuthorizationFilter.java:60)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)

      root cause

      javax.servlet.ServletException: javax.servlet.jsp.JspException: java.lang.NullPointerException
      org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:851)
      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:784)
      org.apache.jsp.protected_.main_jsp._jspService(main_jsp.java:173)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:387)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:320)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:266)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
      com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:408)
      com.sun.faces.application.ViewHandlerImpl.executePageToBuildView(ViewHandlerImpl.java:442)
      com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:115)
      org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
      org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:216)
      com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
      com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
      javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
      org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:141)
      org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:281)
      com.avaning.webapp.servlet.AuthorizationFilter.doFilter(AuthorizationFilter.java:60)
      org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)