Grails插件项目中的jsf2“…工厂javax.faces.context.FacesContextFactory的备份出错”

问题描述 投票:3回答:1

我正在开发模式下运行Grails 2.01和Tomcat(正常的STS开发人员下载)。

我尝试运行jsf插件,但在Grails 2中无法使用。

因此,对我来说,我已经尝试构建自己的本地插件,将其构建为本地v2插件,并在此途中了解插件项目。我一直在(缓慢地)解构Grails jsf2插件,并用一点点的困难方式对其进行重建,并在我学习的过程中学习。

我的问题如下-我在本地构建了插件-称为'wwjsf'。

我已经完成了doWithWebDescriptor的关闭-但是当我运行插件时,我收到一个错误-并且服务器将不会呈现.xhtml文件-任何此类请求都将给出相同的错误。

我已将最新的Mojarra jsf 2.1.7 api / impl文件包含在该项目的构建路径中-这是Grails 2.01中嵌入的默认Tomcat的错误。

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

我已经完成了对web.xml的转储,最后在闭包中进行了窥视。我在Google上查询了该错误,它说您必须设置了facesConfigureListener -我已经设置了,我已经检查了xml中的faces服务器元素,我认为它看起来不错。

[此外,我在WEB-INF下放置了一个空的faces-config.xml(我将担心以后如何在使用该插件的项目中创建该文件),而且正如Google的一些警告所言,将jsf文件保存在WEB-INF / lib目录中-我手动创建了/ lib并复制了我的jsf 2.1.7 api / impl jar以及皮带和花括号。

如何消除嵌入式Tomcat服务器中的此错误?

最终的web.xml配置如下:

 <?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>
grails plugins jsf-2
1个回答
10
投票

[当我收到此错误(我在Spring和jsf2上同时使用Maven和嵌入式码头)时,我在web.xml上添加了它

© www.soinside.com 2019 - 2024. All rights reserved.