running grails 2.01, and tomcat in dev mode (normal STS developer download)
i tried to run the jsf plugin but it wouldnt work in grails 2
so for instruction for me ive tried to build my own local plugin, build it as native v2 plugin and and learn about plugin projects on the way. Been deconstructing (slowly ) the grails jsf2 plugin and rebuilding it the hard way bit by bit and learn as i go
my problem is as follows - i've built my plugin locally - called it 'wwjsf'
i've completed the doWithWebDescriptor closure - but when i run the plugin i get an error with - and the server wont render an .xhtml files - any such request gives same error.
I have included the latest mojarra jsf 2.1.7 api/impl files into my build path for the project - heres the error on default tomcat embedded 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 have done a dump of the web.xml as finalised in the closure to have a peek. I looked up the error up on google and it said you had to have the facesConfigureListener set - which i have, and i have checked the faces server element in the xml and i think it looks good.
in addition i have put an empty faces-config.xml under the WEB-INF (i'll worry about how to create that in a project that uses the plugin later), and as some of the google warnings said i have to have the jsf files in the WEB-INF/lib directory - i manually created that /lib and copied my jsf 2.1.7 api/impl jars into it as well - belt and braces
how do i get rid of this error in the embedded tomcat server ? Kind of stuck now till i can get passed this problem
Help from anyone on the dev forum would be hugely appreciated (apologies first part doesnt want to format even though i have put four spaces before the each row ...) final web.xml config looks like :
<?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>
When i got this error (i use maven and embedded jetty alongside spring and jsf2), I added this on web.xml
<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>
And the error was gone.