0

我做了一个 Icefaces 1.8 升级到 2.0 版本。我知道有些人会告诉我为什么版本是 2.0 而不是 3.0,我很想但我别无选择。由于映射 Faces Servlet,我们遇到了问题。我们有以 exetension .jspx 结尾的 JSP 文件,因此我们添加了一个 url 模式来管理它们。页面的渲染我们有一个stackoverflow,因为我认为有一个无限循环。

  • 使用 url-pattern=*.jspx 我有一个 stackoverflow
  • 使用 url-pattern=/icefaces/* 我有一个 NullPointerException 因为 FacesContext 为空。

堆栈跟踪

java.lang.StackOverflowError
                at com.sun.faces.application.ViewHandlerResponseWrapper.setStatus(ViewHandlerResponseWrapper.java:88)
                at javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:184)
                at com.sun.faces.application.ViewHandlerResponseWrapper.setStatus(ViewHandlerResponseWrapper.java:88)
                at javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:184)
                at com.sun.faces.application.ViewHandlerResponseWrapper.setStatus(ViewHandlerResponseWrapper.java:88)
                at javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:184)
                at com.sun.faces.application.ViewHandlerResponseWrapper.setStatus(ViewHandlerResponseWrapper.java:88)
                at javax.servlet.http.HttpServletResponseWrapper.setStatus(HttpServletResponseWrapper.java:184)
 ...
at com.sun.faces.context.ExternalContextImpl.setResponseStatus(ExternalContextImpl.java:847)
                at com.sun.faces.context.ExceptionHandlerImpl.throwIt(ExceptionHandlerImpl.java:261)
                at com.sun.faces.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:141)
                at org.icefaces.impl.application.ExtendedExceptionHandler.handle(ExtendedExceptionHandler.java:110)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:119)
                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
                at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
                at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
                at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
                at com.sun.faces.context.ExternalContextImpl.dispatch(ExternalContextImpl.java:546)
                at com.sun.faces.application.view.JspViewHandlingStrategy.executePageToBuildView(JspViewHandlingStrategy.java:364)
                at com.sun.faces.application.view.JspViewHandlingStrategy.buildView(JspViewHandlingStrategy.java:154)
                at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:100)
                at com.sun.faces.lifecycle.Phase.doPhase(Phase.java:101)
                at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:139)
                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:410)
                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
                at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
                at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
                at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)

web.xml

<?xml version="1.0"?>

<!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>MYAPPLY</display-name>
    <description>MYAPPLY</description>

    <context-param>
        <param-name>facelets.LIBRARIES</param-name>
        <param-value>/pages/templates/tags.taglib.xml</param-value>
    </context-param>

    <context-param>
        <param-name>contextConfigLocation</param-name>
        <param-value>
            /WEB-INF/appCtx/**/*applicationContext*.xml
        </param-value>
    </context-param>

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

    <!-- Facelet Config  -->
    <context-param>
        <param-name>javax.faces.CONFIG_FILES</param-name>
        <param-value>
            /WEB-INF/faces-config-application-beans.xml,
            /WEB-INF/faces-config-navigation.xml
        </param-value>
    </context-param>

    <context-param>
        <param-name>facelets.DEVELOPMENT</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <param-name>facelets.REFRESH_PERIOD</param-name>
        <param-value>2</param-value>
    </context-param>

    <context-param>
        <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
        <param-value>.jspx</param-value>
    </context-param>

    <context-param>
        <param-name>com.icesoft.faces.standardRequestScope</param-name>
        <param-value>false</param-value>
    </context-param>

    <context-param>
        <param-name>com.icesoft.faces.gmapKey</param-name>
        <param-value>
            ABQIAAAADlu0ZiSTam64EKaCQr9eTRTOTuQNzJNXRlYRLknj4cQ89tFfpxTEqxQnVWL4k55OPICgF5_SOZE06A
        </param-value>
    </context-param>

    <context-param>
        <param-name>com.icesoft.faces.uploadDirectory</param-name>
        <param-value>upload</param-value>
    </context-param>

    <!-- Pas plus de 3Mo pour les upload -->
    <context-param>
        <param-name>com.icesoft.faces.uploadMaxFileSize</param-name>
        <param-value>100000000</param-value>
    </context-param>

    <!-- Specifies to the ICEfaces framework whether to support multiple views of a 
        single application from the same browser.  When running in a Portlet 
        environment, this parameter must be set to true. -->
    <context-param>
        <param-name>com.icesoft.faces.concurrentDOMViews</param-name>
        <param-value>false</param-value>
    </context-param>

    <!-- Specifies to the ICEfaces framework that synchronous update mode is to be 
        used.  By default, ICEfaces uses asynchronous update mode to support 
        server-initiated updates (AJAX push).  Setting to true will enable 
        synchronous update mode and disable AJAX push features. -->
    <context-param>
        <param-name>com.icesoft.faces.synchronousUpdate</param-name>
        <param-value>true</param-value>
    </context-param>

    <!-- Specifies to the ICEfaces framework whether to compress the server-side DOM 
        representation after each response. This saves a considerable amount of
        of memory per client. However, since this is decompressed/compressed for
        every update, it may not bring significant memory savings to applications 
        that make frequent use of AJAX push.-->
    <context-param>
        <param-name>com.icesoft.faces.compressDOM</param-name>
        <param-value>true</param-value>
    </context-param>

    <!-- Specifies the amount of time in milliseconds that the bridge will wait for  
        a response from the server for a user-initiated request before declaring 
        the connection lost.  Un-comment and change the default value, if necessary.    -->
    <context-param>
        <param-name>com.icesoft.faces.connectionTimeout</param-name>
        <param-value>300000</param-value>
    </context-param>


    <!-- Specifies the amount of time in milliseconds that an idle asynchronous 
        blocking connection should be held open before being released. Normally, 
        the blocking connection is closed and re-opened with every communication to 
        the browser, such as user interaction or a heartbeat ping. The purpose of 
        this setting is to remove the possibility of threads being held blocked for 
        a long duration on a dead or completely inactive client connection. This 
        value should be longer than the heartbeat interval to avoid unnecessary
        network traffic.  Un-comment and change the default value, if necessary.-->
    <context-param>
        <param-name>
            com.icesoft.faces.blockingConnectionTimeout
        </param-name>
        <param-value>90000</param-value>
    </context-param>


    <!-- Specifies the amount of time in milliseconds between heartbeat messages.  
        Un-comment and change the default value, if necessary.-->
    <context-param>
        <param-name>com.icesoft.faces.heartbeatInterval</param-name>
        <param-value>50000</param-value>
    </context-param>


    <!-- Specifies how many consecutive heartbeat connection attempts may fail 
        before the connection is considered lost.  Un-comment and change the 
        default value, if necessary.    -->
    <context-param>
        <param-name>com.icesoft.faces.heartbeatRetries</param-name>
        <param-value>2</param-value>
    </context-param>


    <!-- Specifies the number of milliseconds that a heartbeat request waits for a 
        successful response before it is considered timed out.  Un-comment and 
        change the default value, if necessary.-->
    <context-param>
        <param-name>com.icesoft.faces.heartbeatTimeout</param-name>
        <param-value>60000</param-value>
    </context-param>


    <!-- Specifies a page URI to redirect the client to when an asynchronous 
        connection is lost. The parameter value must be surrounded by single 
        quotes.  Un-comment and change the default value, if necessary.-->
    <context-param>
        <param-name>
            com.icesoft.faces.connectionLostRedirectURI
        </param-name>
        <param-value>login.jspx</param-value>
    </context-param>

    <context-param>
        <param-name>
            com.icesoft.faces.sessionExpiredRedirectURI
        </param-name>
        <param-value>login.jspx</param-value>
    </context-param>

    <context-param>
        <param-name>com.icesoft.faces.blockUIOnSubmit</param-name>
        <param-value>true</param-value>
    </context-param>

    <context-param>
        <param-name>log4jConfigLocation</param-name>
        <param-value>classpath:log4j.properties</param-value>
    </context-param>

    <context-param>
        <param-name>log4jExposeWebAppRoot</param-name>
        <param-value>false</param-value>
    </context-param>

    <filter>
        <filter-name>springFilter</filter-name>
        <filter-class>
            org.springframework.web.filter.RequestContextFilter
        </filter-class>
    </filter>

    <filter>
        <filter-name>openSessionInViewFilter</filter-name>
        <filter-class>
            org.springframework.orm.hibernate3.support.OpenSessionInViewFilter
        </filter-class>
        <init-param>
            <param-name>singleSession</param-name>
            <param-value>true</param-value>
        </init-param>
    </filter>

    <filter>
        <filter-name>loggedInFilter</filter-name>
        <filter-class>
            com.omb.LoggedInFilter
        </filter-class>
        <init-param>
            <param-name>userContextBeanName</param-name>
            <param-value>userContext</param-value>
        </init-param>
        <init-param>
            <param-name>loginURI</param-name>
            <param-value>/login.jspx</param-value>
        </init-param>
        <init-param>
            <param-name>ignoredURIs</param-name>
            <param-value>/pages/authentication/login.jspx</param-value>
        </init-param>
    </filter>

    <!-- -->
    <filter-mapping>
        <filter-name>openSessionInViewFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>springFilter</filter-name>
        <url-pattern>/*</url-pattern>
    </filter-mapping>

    <filter-mapping>
        <filter-name>loggedInFilter</filter-name>
        <url-pattern>/pages/*</url-pattern>
    </filter-mapping>

    <!-- SPRING -->
    <listener>
        <listener-class>
            org.springframework.web.util.Log4jConfigListener
        </listener-class>
    </listener>

    <listener>
        <listener-class>
            org.springframework.web.context.ContextLoaderListener
        </listener-class>
    </listener>

    <listener>
        <listener-class>
            org.springframework.web.context.request.RequestContextListener
        </listener-class>
    </listener>

    <listener>
        <listener-class>
            org.springframework.web.util.IntrospectorCleanupListener
        </listener-class>
    </listener>

    <listener>
        <listener-class>
            com.accor.hrep.ChainScheduler
        </listener-class>
    </listener>




    <!-- Faces 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>Faces Servlet</servlet-name>
        <url-pattern>*.jspx</url-pattern>
    </servlet-mapping>

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

    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>


    <!-- Welcome files -->
    <welcome-file-list>
        <welcome-file>login.jspx</welcome-file>
    </welcome-file-list>


        <error-page>
        <error-code>500</error-code>
        <location>/pages/error.jsp</location>
        </error-page>
        <error-page>
        <exception-type>java.lang.RuntimeException</exception-type>
        <location>/pages/error.jsp</location>
        </error-page>

</web-app>

面孔-config.xml

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

    <application>
        <variable-resolver>
            org.springframework.web.jsf.DelegatingVariableResolver
        </variable-resolver>
        <variable-resolver>
            org.springframework.web.jsf.SpringBeanVariableResolver
        </variable-resolver>
        <el-resolver>
            org.springframework.web.jsf.el.SpringBeanFacesELResolver 
        </el-resolver> 
    </application>

</faces-config>

面孔-配置-应用程序-beans.xml

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">
    <managed-bean>
        <managed-bean-name>renderManager</managed-bean-name>
        <managed-bean-class>
            com.icesoft.faces.async.render.RenderManager
        </managed-bean-class>
        <managed-bean-scope>application</managed-bean-scope>
    </managed-bean>

</faces-config>

面孔配置导航.xml

<?xml version="1.0" encoding="UTF-8"?>
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
    version="2.0">

    <navigation-rule>
        <from-view-id>/login.jspx</from-view-id>
        <navigation-case>
            <from-outcome>menu</from-outcome>
            <to-view-id>
                /pages/menu/menu.jspx
            </to-view-id>
        </navigation-case>
    </navigation-rule>

    <navigation-rule>
        <from-view-id>/login.jspx</from-view-id>
        <navigation-case>
            <from-outcome>sop</from-outcome>
            <to-view-id>
                /pages/folder/folderListSop.jspx
            </to-view-id>
        </navigation-case>
    </navigation-rule>

    <navigation-rule>
        <from-view-id>/pages/menu/menu.jspx</from-view-id>
        <navigation-case>
            <from-outcome>folderList</from-outcome>
            <to-view-id>
                /pages/folder/folderList.jspx
            </to-view-id>
        </navigation-case>
    </navigation-rule>

    <navigation-rule>
        <from-view-id>/pages/menu/menu.jspx</from-view-id>
        <navigation-case>
            <from-outcome>manualUpload</from-outcome>
            <to-view-id>
                /pages/folder/manualUpload.jspx
            </to-view-id>
        </navigation-case>
    </navigation-rule>

    <navigation-rule>
        <from-view-id>*</from-view-id>
        <navigation-case>
            <from-outcome>home</from-outcome>
            <to-view-id>
                /pages/menu/menu.jspx
            </to-view-id>
        </navigation-case>
        <navigation-case>
            <from-outcome>disconnect</from-outcome>
            <to-view-id>/login.jspx</to-view-id>
            <redirect />
        </navigation-case>
    </navigation-rule>

</faces-config>

JSP 文件:

<!-- 
<%@taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@taglib uri="http://java.sun.com/jstl/core" prefix="c"%>
<%@taglib uri="http://java.sun.com/jsf/facelets" prefix="ui"%>
<%@taglib uri="http://www.icesoft.com/icefaces/component" prefix="ice"%>
 -->
    <!--
<ui:decorate template="/pages/layer/layout.jspx"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:c="http://java.sun.com/jstl/core"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:ice="http://www.icesoft.com/icefaces/component">

    <ui:define name="body">
    -->
        <ice:form id="loginForm">

                    <table styleClass="loginTable">
                        <tr>
                            <td align="right" styleClass="loginTableLabel">
                                <ice:outputLabel value="Login" />
                            </td>
                            <td align="left" styleClass="loginTableField">
                                <ice:inputText value="#{loginBB.login}" />
                            </td>
                        </tr>
                        <tr>
                            <td align="right" styleClass="loginTableLabel">
                                <ice:outputLabel value="Password" />
                            </td>
                            <td align="left" styleClass="loginTableField">
                                <ice:inputSecret value="#{loginBB.password}" />
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2"><ice:panelGroup >
                                <ice:commandLink action="#{loginBB.doLogin}"
                                    value="Confirmer"
                                    />
                            </ice:panelGroup></td>
                        </tr>
                    </table>

        </ice:form>
<!--
    </ui:define>

</ui:decorate>
-->
4

1 回答 1

0

我找到了解决方案,问题是 web.xml 不正确。

http://www.icesoft.org/wiki/display/ICE/Converting+ICEfaces+1.8+Applications+to+ICEfaces+3

于 2013-10-03T23:05:39.177 回答