Getting - error with jsf2 "... fallback for factory javax.faces.context.FacesContextFactory". in grails plugin project

running grails 2.01 and tomcat in dev mode (normal STS developer boot)

I tried to run jsf plugin but it would not work in grails 2

so for instructions for me, I tried to create my own local plugin, build it as a native v2 plugin and learn about plugin projects along the way. Was to deconstruct (slowly) the grails jsf2 plugin and rebuild it differently and find out how I go

my problem is this: i created a local plugin - wwjsf

I ended up closing doWithWebDescriptor - but when I run the plugin I get an error - and the server won't render .xhtml files - any such request gives the same error.

I have included the latest jsf 2.1.7 api / impl modjars in my build path for the project - this is the default tomcat bug built in grails 2.01

Message: Could not find backup for factory javax.faces.context.FacesContextFactory.
Line | Method
->> 1008 | getFactory in javax.faces.FactoryFinder$FactoryManager
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    343 | getFactory in javax.faces.FactoryFinder
|    302 | init . . . in javax.faces.webapp.FacesServlet
|    303 | innerRun   in java.util.concurrent.FutureTask$Sync
|    138 | run . . .  in java.util.concurrent.FutureTask
|    886 | runTask    in java.util.concurrent.ThreadPoolExecutor$Worker
|    908 | run . . .  in     ''
^    662 | run        in java.lang.Thread
| Error 2012-04-04 18:32:55,748 [pool-6-thread-1] ERROR [localhost].[/wwjsf]  - Servlet    /wwjsf threw load() exception
Message: Could not find backup for factory javax.faces.context.FacesContextFactory.
Line | Method
->> 1008 | getFactory in javax.faces.FactoryFinder$FactoryManager
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|    343 | getFactory in javax.faces.FactoryFinder
|    302 | init . . . in javax.faces.webapp.FacesServlet
|    303 | innerRun   in java.util.concurrent.FutureTask$Sync
|    138 | run . . .  in java.util.concurrent.FutureTask
|    886 | runTask    in java.util.concurrent.ThreadPoolExecutor$Worker
|    908 | run . . .  in     ''
^    662 | run        in java.lang.Thread
| Server running. Browse to http://localhost:8080/wwjsf

      

I dumped web.xml as complete in closure to take a peek. I was looking for a bug on google and it said you should have the ConfigureListener functions installed that I have and I checked the face server element in the xml and I think it looks good.

Also, I have put empty edges-config.xml under WEB-INF (I will worry about how to create this in a project that uses the plugin later) and as some of the google warnings say I have to have jsf files in the WEB-INF / lib directory - I manually created this / lib and copied jarf 2.1.7 api / impl jars into it - strap and curly braces

How can I get rid of this error in embedded tomcat server? Kind is stuck now until I can get past this issue

Help from any of the forum developers would be very much appreciated (apologies that the first part doesn't want to format, although I put four spaces in front of each line ...) The final web.xml config looks like this:

 <?xml version="1.0" encoding="UTF-8"?>
 <web-app xmlns="http://java.sun.com/xml/ns/javaee" 
    xmlns:xsi="http://www.w3.org /2001/XMLSchema-instance" 
    metadata-complete="true" version="2.5" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee 
    http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
   <display-name>/wwjsf-development-null</display-name>
   <context-param>
      <param-name>contextConfigLocation</param-name>
      <param-value>/WEB-INF/applicationContext.xml</param-value>
   </context-param>
   <context-param>
     <param-name>com.sun.faces.validateXml</param-name>
     <param-value>false</param-value>
   </context-param>
   <context-param>
      <param-name>com.sun.faces.verifyObjects</param-name>
      <param-value>false</param-value>
   </context-param>
   <context-param>
      <param-name>javax.faces.application.CONFIG_FILES</param-name>
      <param-value>C:\Users\802518659\Documents\grails-workspace\wwjsf\web-app\WEB-INF\faces-config.xml</param-value>
   </context-param>
   <context-param>
      <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
      <param-value>server</param-value>
   </context-param>
   <context-param>
      <param-name>javax.faces.FACELETS_RESOURCE_RESOLVER</param-name>
      <param-value>com.softwood.grails.jsf.facelets.GrailsResourceResolver</param-value>
   </context-param>
   <context-param>
      <param-name>javax.faces.PROJECT_STAGE</param-name>
      <param-value>Production</param-value>
   </context-param>
   <context-param>
      <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
      <param-value>.xhtml</param-value>
   </context-param>
   <context-param>
      <param-name>javax.faces.REFRESH_PERIOD</param-name>
      <param-value>0</param-value>
   </context-param>
   <context-param>
      <param-name>webAppRootKey</param-name>
      <param-value>wwjsf-development-null</param-value>
   </context-param>
   <filter>
     <filter-name>sitemesh</filter-name>
     <filter-class>org.codehaus.groovy.grails.web.sitemesh.GrailsPageFilter</filter-class>
   </filter>
   <filter>
     <filter-name>charEncodingFilter</filter-name>
     <filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
     <init-param>
        <param-name>targetBeanName</param-name>
        <param-value>characterEncodingFilter</param-value>
     </init-param>
     <init-param>
        <param-name>targetFilterLifecycle</param-name>
        <param-value>true</param-value>
     </init-param>
   </filter>
   <filter>
      <filter-name>urlMapping</filter-name>
      <filter-class>org.codehaus.groovy.grails.web.mapping.filter.UrlMappingsFilter</filter-class>
   </filter>
   <filter>
     <filter-name>hiddenHttpMethod</filter-name>
     <filter-class>org.codehaus.groovy.grails.web.filters.HiddenHttpMethodFilter</filter-class>
   </filter>
   <filter>
      <filter-name>grailsWebRequest</filter-name>
      <filter-class>org.codehaus.groovy.grails.web.servlet.mvc.GrailsWebRequestFilter</filter-class>
   </filter>
   <filter-mapping>
      <filter-name>charEncodingFilter</filter-name>
      <url-pattern>/*</url-pattern>
   </filter-mapping>
   <filter-mapping>
      <filter-name>hiddenHttpMethod</filter-name>
      <url-pattern>/*</url-pattern>
     <dispatcher>FORWARD</dispatcher>
     <dispatcher>REQUEST</dispatcher>
   </filter-mapping>
   <filter-mapping>
      <filter-name>grailsWebRequest</filter-name>
      <url-pattern>/*</url-pattern>
      <dispatcher>FORWARD</dispatcher>
      <dispatcher>REQUEST</dispatcher>
      <dispatcher>ERROR</dispatcher>
   </filter-mapping>
   <filter-mapping>
      <filter-name>sitemesh</filter-name>
       <url-pattern>/*</url-pattern>
       <dispatcher>REQUEST</dispatcher>
       <dispatcher>ERROR</dispatcher>
   </filter-mapping>
   <filter-mapping>
      <filter-name>urlMapping</filter-name>
      <url-pattern>/*</url-pattern>
      <dispatcher>FORWARD</dispatcher>
      <dispatcher>REQUEST</dispatcher>
   </filter-mapping>
   <listener>
      <listener-class>org.codehaus.groovy.grails.plugins.log4j.web.util.Log4jConfigListener</listener-class>
   </listener>
   <listener>
      <listener-class>com.sun.faces.config.ConfigureListener</listener-class>
    </listener>
    <listener>
        <listener-class>org.codehaus.groovy.grails.web.context.GrailsContextLoaderListener</listener-class>
    </listener>
  <servlet>
   <servlet-name>H2Console</servlet-name>
   <servlet-class>org.h2.server.web.WebServlet</servlet-class>
   <init-param>
    <param-name>-webAllowOthers</param-name>
    <param-value>true</param-value>
   </init-param>
   <load-on-startup>2</load-on-startup>
  </servlet>
  <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>H2Console</servlet-name>
    <url-pattern>/dbconsole/*</url-pattern>
    </servlet-mapping>
  <servlet-mapping>
     <servlet-name>Faces Servlet</servlet-name>
     <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>

  <servlet>
    <servlet-name>grails</servlet-name>
    <servlet-class>org.codehaus.groovy.grails.web.servlet.GrailsDispatcherServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet>
    <servlet-name>gsp</servlet-name>
    <servlet-class>org.codehaus.groovy.grails.web.pages.GroovyPagesServlet</servlet-class>
    <init-param>
    <description>
            Allows developers to view the intermediate source code, when they pass
            a spillGroovy argument in the URL.
            </description>
    <param-name>showSource</param-name>
    <param-value>1</param-value>
    </init-param>
  </servlet>
  <servlet>
     <servlet-name>grails-errorhandler</servlet-name>
     <servlet-class>org.codehaus.groovy.grails.web.servlet.ErrorHandlingServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>gsp</servlet-name>
    <url-pattern>*.gsp</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
   <servlet-name>grails-errorhandler</servlet-name>
   <url-pattern>/grails-errorhandler</url-pattern>
  </servlet-mapping>
  <servlet-mapping>
     <servlet-name>grails</servlet-name>
     <url-pattern>*.dispatch</url-pattern>
  </servlet-mapping>
  <welcome-file-list>

    <welcome-file>index.html</welcome-file>
    <welcome-file>index.jsp</welcome-file>
    <welcome-file>index.gsp</welcome-file>
  </welcome-file-list>
  <error-page>
    <error-code>500</error-code>
    <location>/grails-errorhandler</location>
 </error-page>
 <jsp-config>
    <taglib>
        <taglib-uri>http://java.sun.com/jsp/jstl/core</taglib-uri>
        <taglib-location>/WEB-INF/tld/c.tld</taglib-location>
    </taglib>
       <taglib>
           <taglib-uri>http://java.sun.com/jsp/jstl/fmt</taglib-uri>
           <taglib-location>/WEB-INF/tld/fmt.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>http://www.springframework.org/tags</taglib-uri>
            <taglib-location>/WEB-INF/tld/spring.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>http://grails.codehaus.org/tags</taglib-uri>
            <taglib-location>/WEB-INF/tld/grails.tld</taglib-location>
        </taglib>
    </jsp-config>
 </web-app>

      

+3


source to share


1 answer


When I got this error (I am using maven and inline jetty along with spring and jsf2) I added this to web.xml

 <listener>
        <listener-class>com.sun.faces.config.ConfigureListener</listener-class> 
    </listener>

      



And the error was gone.

+10


source







All Articles