0 Replies Latest reply on Nov 25, 2009 3:42 PM by Phil Wilson

    FacesContext is null in tomcat logs

    Phil Wilson Apprentice

      Hi All,

      I have been working on this issue for the last week. I can't seem to figure it out. My logs in Tomcat 6 are filled with errors like this..:

      Nov 16, 2009 7:36:00 PM org.apache.catalina.core.StandardWrapperValve invoke
      SEVERE: Servlet.service() for servlet Faces Servlet threw exception
      java.lang.NullPointerException: FacesContext is null
       at org.ajax4jsf.context.AjaxContext.getCurrentInstance(AjaxContext.java:126)
       at org.ajax4jsf.context.AjaxContext.getCurrentInstance(AjaxContext.java:111)
       at org.ajax4jsf.component.AjaxViewRoot.getViewId(AjaxViewRoot.java:576)
       at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:104)
       at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
       at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
       at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:154)
       at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:265)
       at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:376)
       at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:503)



      It might be the way I am using includes.
      currently I am using

      <%@ include file="common/footer.jsp" %>


      but was told to change to
      <a4j:include viewId="common/footer.jsp"></a4j:include>
      or
       <jsp:include page="common/footer.jsp" flush = "true" />
      
      


      This is great but I can't seem to get this to work with my application. I updated the
      Standard.jar and
      jstl-1.2.jar

      That did not help.

      I get this error now.

      now I get this error...SEVERE: Servlet.service() for servlet jsp threw exception
      org.apache.jasper.JasperException: /common/footer.jsp(6,55) #{..} is not allowed in template text

      Tomcat 6.0
      how do I fix this issue??

      This is the code example.

      Welcome.jsp

      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
      
      <%
      String path = request.getContextPath();
      String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
      %>
      
      <html>
      
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
      <%@ taglib uri="http://richfaces.org/rich" prefix="rich"%>
      <%@ taglib uri="http://richfaces.org/a4j" prefix="a4j"%>
      
      <f:view>
      <HEAD></HEAD>
      <body>
      <a4j:form id="f1" >
      <table align="center" border="0" width="825" cellpadding="0" cellspacing="0">
      
      
      <a4j:include viewId="common/footer.jsp"></a4j:include>
      
      
       </table>
       </a4j:form>
      
       </body>
       </f:view>
      </html>



      Footer.jsp

      <f:loadBundle basename="loadNet" var="NetFixBundlefoot"/>
      <tr >
      <table align="center" border="0" width="910">
       <tr>
       <td align="left"><a href="/emailFormContactUs.jsf">Contact Us</a></td>
       <td align="right" width="50%"><h:outputText value="#{NetFixBundlefoot.netFixUpFooter}" /> copy sign </td>
       </tr>
      </table>
      
      <table align="center" border="0" width="910">
       <tr>
       <td align="center">
       </td>
       </tr>
      </table>
      
      </tr>



      Runtime error in Tomcat 6
      INFO: Server startup in 11609 ms
      Nov 24, 2009 9:11:36 PM org.apache.catalina.core.ApplicationDispatcher invoke
      
      SEVERE: Servlet.service() for servlet jsp threw exception
      org.apache.jasper.JasperException: /common/footer.jsp(7,55) #{..} is not allowed in template text
      
       at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
       at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
       at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:102)
       at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:711)
       at org.apache.jasper.compiler.Node$ELExpression.accept(Node.java:940)
       at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
       at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
       at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
       at org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
       at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
       at org.apache.jasper.compiler.Validator.validate(Validator.java:1737)
       at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:165)
       at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
       at org.apache.jasper.compiler.Compiler.compile(Compiler.java:294)
       at org.apache.jasper.compiler.Compiler.compile(Compiler.java:281)