5 Replies Latest reply on Oct 25, 2006 5:02 PM by Gavin King

    Faces context not found. getResponseWriter will fail.

    Stjepan Matijasevic Newbie

      I made simple JSF app. and try to implement Seam. After I deploy app on JBoss and try to open first jsp page I get this exception:


      14:51:36,421 INFO [Server] JBoss (MX MicroKernel) [4.0.3SP1 (build: CVSTag=JBoss_4_0_3_SP1 date=200510231751)] Started
      in 38s:234ms
      14:51:56,000 ERROR [UIComponentTag] Faces context not found. getResponseWriter will fail. Check if the FacesServlet has
      been initialized at all in your web.xml.
      14:51:56,000 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
      java.lang.NullPointerException
      at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:615)
      at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:217)
      at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:71)
      at org.apache.jsp.jspPages.login.loginPage_jsp._jspx_meth_f_view_0(org.apache.jsp.jspPages.login.loginPage_jsp:9
      9)
      at org.apache.jsp.jspPages.login.loginPage_jsp._jspService(org.apache.jsp.jspPages.login.loginPage_jsp:74)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
      at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
      at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
      at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:52)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)
      14:51:56,000 ERROR [[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
      java.lang.NullPointerException
      at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:615)
      at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:217)
      at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:71)
      at org.apache.jsp.jspPages.login.loginPage_jsp._jspx_meth_f_view_0(org.apache.jsp.jspPages.login.loginPage_jsp:9
      9)
      at org.apache.jsp.jspPages.login.loginPage_jsp._jspService(org.apache.jsp.jspPages.login.loginPage_jsp:74)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
      at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
      at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
      at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:52)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)
      14:51:56,000 ERROR [[jsp]] Servlet.service() for servlet jsp threw exception
      java.lang.NullPointerException
      at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:615)
      at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:217)
      at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:71)
      at org.apache.jsp.jspPages.login.loginPage_jsp._jspx_meth_f_view_0(org.apache.jsp.jspPages.login.loginPage_jsp:9
      9)
      at org.apache.jsp.jspPages.login.loginPage_jsp._jspService(org.apache.jsp.jspPages.login.loginPage_jsp:74)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:322)
      at com.sun.faces.application.ViewHandlerImpl.renderView(ViewHandlerImpl.java:130)
      at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:87)
      at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:200)
      at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:117)
      at javax.faces.webapp.FacesServlet.service(FacesServlet.java:198)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:672)
      at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:463)
      at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:398)
      at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:301)
      at org.apache.jasper.runtime.PageContextImpl.doForward(PageContextImpl.java:693)
      at org.apache.jasper.runtime.PageContextImpl.forward(PageContextImpl.java:660)
      at org.apache.jsp.index_jsp._jspService(org.apache.jsp.index_jsp:52)
      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:322)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:81)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
      at org.jboss.web.tomcat.security.CustomPrincipalValve.invoke(CustomPrincipalValve.java:39)
      at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:159)
      at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:59)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:744)
      at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
      at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
      at java.lang.Thread.run(Thread.java:595)


      The app is very simple. I have two pages. First is loginPage.jsp and secon is helloPage.jsp. On first page I have one label and command button that navigate me to the secon page witch navigate me to first page.

      There is no date so I don't have class with entity anotations.

      here is my jsp pages:
      <%@ page language="java" contentType="text/html; charset=UTF-8"
      pageEncoding="UTF-8"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">



      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Po?etna stranica



      <f:view>
      <h:form>
      <h:outputText value="This is first page"/>
      <h:commandButton value="Click me!" action="#{register.logIn}" />
      </h:form>
      </f:view>







      second jsp page:
      <%@ page language="java" contentType="text/html; charset=UTF-8"
      pageEncoding="UTF-8"%>
      <%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
      <%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">


      <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
      Hello page



      <f:view>
      <h:form>
      <h:outputText value="This is secon page."/>
      <h:commandButton value="Click me" action="#{register.logOut}"/>
      </h:form>
      </f:view>







      faces-config.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE faces-config PUBLIC "-//Sun Microsystems, Inc.//DTD JavaServer Faces Config 1.1//EN"
      "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
      <faces-config>

      <navigation-rule>
      <from-view-id>/jspPages/login/loginPage.jsp</from-view-id>
      <navigation-case>
      <from-outcome>login_OK</from-outcome>
      <to-view-id>/jspPages/helloPage/helloPage.jsp</to-view-id>
      </navigation-case>
      </navigation-rule>

      <navigation-rule>
      <from-view-id>/jspPages/helloPage/helloPage.jsp</from-view-id>
      <navigation-case>
      <from-outcome>logout_OK</from-outcome>
      <to-view-id>/jspPages/login/loginPage.jsp</to-view-id>
      </navigation-case>
      </navigation-rule>



      <phase-listener>org.jboss.seam.jsf.SeamPhaseListener</phase-listener>



      <locale-config/>


      </faces-config>


      web.xml:
      <?xml version="1.0" encoding="UTF-8"?>
      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd">

      <web-app>

      <display-name>Lons</display-name>

      <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>server</param-value>
      </context-param>

      <context-param>
      <param-name>javax.faces.application.CONFIG_FILES</param-name>
      <param-value>/WEB-INF/faces-config.xml</param-value>
      </context-param>

      <context-param>
      <param-name>org.jboss.seam.core.init.jndiPattern</param-name>
      <param-value>#{ejbName}/local</param-value>
      </context-param>


      <listener-class>org.jboss.seam.servlet.SeamListener</listener-class>


      <!-- Faces Servlet -->

      <servlet-name>Faces Servlet</servlet-name>
      <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
      <load-on-startup> 1 </load-on-startup>


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

      <!-- Welcome File List -->
      <welcome-file-list>
      <welcome-file>index.jsp</welcome-file>
      </welcome-file-list>

      </web-app>


      RegisterAction.java:

      package test;

      import javax.ejb.Interceptors;
      import javax.ejb.Stateless;

      import org.jboss.seam.annotations.Name;
      import org.jboss.seam.ejb.SeamInterceptor;


      @Stateless
      @Name("register")
      @Interceptors(SeamInterceptor.class)
      public class RegisterAction implements Register{

      public String logIn(){
      return "login_OK";
      }

      public String logOut(){
      return "logout_OK";
      }

      }

      What else do I need to make this simple app work?
      Thanks!