1 Reply Latest reply on Aug 30, 2007 10:57 AM by earniedyke

    MyFaces problem

    earniedyke

      Greetings all,

      I am trying to develop my first Java Server Faces application on 4.0.5 and I am getting the error below. As you can see, it does not appear to be loading myfaces-api or myfaces-impl. I have upgrade to MyFaces 1.1.5 as suggested but I am still getting this error. Below are my web.xml, faces-config.xml and the jsp I am trying to execute.

      What am I missing?

      Thanks in advance for any and all help.

      Earnie!

      2007-08-30 10:07:11,046 INFO [org.jboss.web.tomcat.tc5.TomcatDeployer] deploy, ctxPath=/Sim, warUrl=.../tmp/deploy/tmp54598Sim-exp.war/
      2007-08-30 10:07:11,546 INFO [org.apache.myfaces.config.FacesConfigurator] Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
      2007-08-30 10:07:11,859 INFO [org.apache.myfaces.config.FacesConfigurator] Reading config /WEB-INF/faces-config.xml
      2007-08-30 10:07:12,015 INFO [org.apache.myfaces.config.FacesConfigurator] MyFaces-package : myfaces-api not found.
      2007-08-30 10:07:12,015 INFO [org.apache.myfaces.config.FacesConfigurator] MyFaces-package : myfaces-impl not found.
      2007-08-30 10:07:12,015 INFO [org.apache.myfaces.config.FacesConfigurator] MyFaces-package : tomahawk-sandbox not found.
      2007-08-30 10:07:12,015 INFO [org.apache.myfaces.config.FacesConfigurator] MyFaces-package : tomahawk not found.
      2007-08-30 10:07:12,031 WARN [org.apache.myfaces.shared_impl.util.LocaleUtils] Locale name in faces-config.xml null or empty, setting locale to default locale : en_US
      2007-08-30 10:07:12,250 INFO [org.apache.myfaces.config.FacesConfigurator] Serialization provider : class org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
      2007-08-30 10:07:12,265 INFO [org.apache.myfaces.webapp.StartupServletContextListener] ServletContext 'C:\JBoss\jboss-4.0.5.GA\server\default\.\tmp\deploy\tmp54598Sim-exp.war\' initialized.
      2007-08-30 10:07:21,343 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/Sim].[jsp]] Servlet.service() for servlet jsp threw exception
      javax.faces.FacesException: Faces context not found. getResponseWriter will fail. Check if the FacesServlet has been initialized at all in your web.xml configuration fileand if you are accessing your jsf-pages through the correct mapping. E.g.: if your FacesServlet is mapped to *.jsf (with the <servlet-mapping>-element), you need to access your pages as 'sample.jsf'. If you tried to access 'sample.jsp', you'd get this error-message.
       at javax.faces.webapp.UIComponentTag.setupResponseWriter(UIComponentTag.java:926)
       at javax.faces.webapp.UIComponentTag.doStartTag(UIComponentTag.java:313)
       at org.apache.myfaces.taglib.core.ViewTag.doStartTag(ViewTag.java:73)
       at org.apache.jsp.Sim_jsp._jspx_meth_f_view_0(Sim_jsp.java:87)
       at org.apache.jsp.Sim_jsp._jspService(Sim_jsp.java:63)
       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:334)
       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 sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
       at java.security.AccessController.doPrivileged(Native Method)
       at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
       at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
       at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:161)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:245)
       at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
       at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
       at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
       at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
       at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
       at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
       at java.lang.reflect.Method.invoke(Method.java:585)
       at org.apache.catalina.security.SecurityUtil$1.run(SecurityUtil.java:243)
       at java.security.AccessController.doPrivileged(Native Method)
       at javax.security.auth.Subject.doAsPrivileged(Subject.java:517)
       at org.apache.catalina.security.SecurityUtil.execute(SecurityUtil.java:275)
       at org.apache.catalina.security.SecurityUtil.doAsPrivilege(SecurityUtil.java:217)
       at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:197)
       at org.apache.catalina.core.ApplicationFilterChain.access$000(ApplicationFilterChain.java:50)
       at org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain.java:156)
       at java.security.AccessController.doPrivileged(Native Method)
       at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:152)
       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.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
       at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
       at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
       at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
       at org.jboss.web.tomcat.tc5.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:156)
       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:869)
       at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
       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)
      


      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>Sim Execution Web App</display-name>
      
       <context-param>
       <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
       <param-value>server</param-value>
       <description>
       State saving method: "client" or "server" (= default)
       See JSF Specification 2.5.2
       </description>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
       <param-value>true</param-value>
       <description>
       This parameter tells MyFaces if javascript code should be allowed in the
       rendered HTML output.
       If javascript is allowed, command_link anchors will have javascript code
       that submits the corresponding form.
       If javascript is not allowed, the state saving info and nested parameters
       will be added as url parameters.
       Default: "true"
       </description>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
       <param-value>false</param-value>
       <description>
       This parameter tells MyFaces if javascript code should be allowed in the
       rendered HTML output.
       If javascript is allowed, command_link anchors will have javascript code
       that submits the corresponding form.
       If javascript is not allowed, the state saving info and nested parameters
       will be added as url parameters.
       Default: "false"
      
       Setting this param to true should be combined with STATE_SAVING_METHOD "server" for
       best results.
      
       This is an EXPERIMENTAL feature. You also have to enable the detector
       filter/filter mapping below to get JavaScript detection working.
       </description>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
       <param-value>true</param-value>
       <description>
       If true, rendered HTML code will be formatted, so that it is "human readable".
       i.e. additional line separators and whitespace will be written, that do not
       influence the HTML code.
       Default: "true"
       </description>
       </context-param>
      
       <context-param>
       <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
       <param-value>true</param-value>
       <description>
       If true, a javascript function will be rendered that is able to restore the
       former vertical scroll on every request. Convenient feature if you have pages
       with long lists and you do not want the browser page to always jump to the top
       if you trigger a link or button action that stays on the same page.
       Default: "false"
       </description>
       </context-param>
      
       <listener>
       <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
       </listener>
      
       <servlet>
       <servlet-name>Faces Servlet</servlet-name>
       <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
       <load-on-startup>1</load-on-startup>
       </servlet>
      
       <servlet-mapping>
       <servlet-name>Faces Servlet</servlet-name>
       <url-pattern>*.faces</url-pattern>
       </servlet-mapping>
      
      </web-app>


      faces-config.xml

      <?xml version='1.0' encoding='UTF-8'?>
      <!DOCTYPE faces-config PUBLIC
       "-//Sun Microsystems, Inc.//DTD JSF Config 1.1//EN"
       "http://java.sun.com/dtd/web-facesconfig_1_1.dtd">
      <faces-config>
       <navigation-rule>
       <from-view-id>/Sim.jsp</from-view-id>
       <navigation-case>
       <from-outcome>success</from-outcome>
       <to-view-id>/SimResponse.jsp</to-view-id>
       </navigation-case>
       </navigation-rule>
       <navigation-rule>
       <from-view-id>/Sim.jsp</from-view-id>
       <navigation-case>
       <from-outcome>success</from-outcome>
       <to-view-id>/SimResponse.jsp</to-view-id>
       </navigation-case>
       </navigation-rule>
      
       <managed-bean>
       <managed-bean-name>simBean</managed-bean-name>
       <managed-bean-class>
       org.ebsinc.sim.bean.SimBean
       </managed-bean-class>
       <managed-bean-scope>session</managed-bean-scope>
       </managed-bean>
      
      </faces-config>