You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Scott Carter <ca...@gmail.com> on 2009/07/07 08:45:13 UTC

faces-config.xml file is read on every page request

I posted a few days back with an issue about the managed beans being
recreated on every page request.  I changed my dependencies to now use
MyFaces 1.2.7, and that problem seemed to have stopped.  But I now notice
that everytime I request a page, anything *.jsf, I notice in the logs that
the faces-config.xml file is reread.  It really seems that everytime I
request a page that all of the configs are read again.  This behavior scares
me quite a bit, as I need to ensure in a production environment that I can
relay on session data, etc ...

This behavior only occurs in production, and can not be replicated on any of
our test servers.  Is this at all normal, or is there a way to stop this.
Is this something that should worry me on a production server?  Any help
figuring this out would really be appreciated.  The differences between
production and testing environments are :  production is linux, testing is
windows and production is Tomcat + Apache Web Server and testing is just
Tomcat.  Here is a snippit from our web.xml for configuring Myfaces:

<!-- Listener, to allow Jetty serving MyFaces apps -->
    <listener>

<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</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>

    <!-- Faces Servlet Mapping -->
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>*.jsf</url-pattern>
    </servlet-mapping>



Here is a copy of the log that shows the reloading of the config.  Keep in
mind this occurs on every request of a *.jsf page:

Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
feedStandardConfig
INFO: Reading standard config META-INF/standard-faces-config.xml
Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
feedClassloaderConfigurations
INFO: Reading config :
jar:file:/home/scottallen/roadmap/rmths/WEB-INF/lib/tomahawk-1.1.9.jar!/META-INF/faces-config.xml
Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
feedWebAppConfig
INFO: Reading config /WEB-INF/faces-config.xml
Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
logMetaInf
INFO: Starting up MyFaces-package : myfaces-api in version : 1.2.7 from path
: file:/home/scottallen/roadmap/rmths/WEB-INF/lib/myfaces-api-1.2.7.jar
Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
logMetaInf
INFO: Starting up MyFaces-package : myfaces-impl in version : 1.2.7 from
path :
file:/home/scottallen/roadmap/rmths/WEB-INF/lib/myfaces-impl-1.2.7.jar
Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
logMetaInf
INFO: MyFaces-package : tomahawk-sandbox15 not found.
Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
logMetaInf
INFO: MyFaces-package : tomahawk-sandbox not found.
Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
logMetaInf
INFO: Starting up MyFaces-package : tomahawk in version : 1.1.9 from path :
file:/home/scottallen/roadmap/rmths/WEB-INF/lib/tomahawk-1.1.9.jar
Jul 6, 2009 11:19:59 PM org.apache.myfaces.shared_impl.util.LocaleUtils
toLocale
WARNING: Locale name in faces-config.xml null or empty, setting locale to
default locale : en_US
Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
handleSerialFactory
INFO: Serialization provider : class
org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory

Re: faces-config.xml file is read on every page request

Posted by Leonardo Uribe <lu...@gmail.com>.
Hi

This behavior is controlled by org.apache.myfaces.CONFIG_REFRESH_PERIOD
config init param. The default value is 2 (seconds), so if you want to
disable it, just add this to your web.xml

    <context-param>
        <param-name>org.apache.myfaces.CONFIG_REFRESH_PERIOD</param-name>
        <param-value>0</param-value>
    </context-param>

regards

Leonardo Uribe

2009/7/7 Scott Carter <ca...@gmail.com>

> I posted a few days back with an issue about the managed beans being
> recreated on every page request.  I changed my dependencies to now use
> MyFaces 1.2.7, and that problem seemed to have stopped.  But I now notice
> that everytime I request a page, anything *.jsf, I notice in the logs that
> the faces-config.xml file is reread.  It really seems that everytime I
> request a page that all of the configs are read again.  This behavior scares
> me quite a bit, as I need to ensure in a production environment that I can
> relay on session data, etc ...
>
> This behavior only occurs in production, and can not be replicated on any
> of our test servers.  Is this at all normal, or is there a way to stop
> this.  Is this something that should worry me on a production server?  Any
> help figuring this out would really be appreciated.  The differences between
> production and testing environments are :  production is linux, testing is
> windows and production is Tomcat + Apache Web Server and testing is just
> Tomcat.  Here is a snippit from our web.xml for configuring Myfaces:
>
> <!-- Listener, to allow Jetty serving MyFaces apps -->
>     <listener>
>
> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</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>
>
>     <!-- Faces Servlet Mapping -->
>     <servlet-mapping>
>         <servlet-name>Faces Servlet</servlet-name>
>         <url-pattern>*.jsf</url-pattern>
>     </servlet-mapping>
>
>
>
> Here is a copy of the log that shows the reloading of the config.  Keep in
> mind this occurs on every request of a *.jsf page:
>
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
> feedStandardConfig
> INFO: Reading standard config META-INF/standard-faces-config.xml
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
> feedClassloaderConfigurations
> INFO: Reading config :
> jar:file:/home/scottallen/roadmap/rmths/WEB-INF/lib/tomahawk-1.1.9.jar!/META-INF/faces-config.xml
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
> feedWebAppConfig
> INFO: Reading config /WEB-INF/faces-config.xml
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
> logMetaInf
> INFO: Starting up MyFaces-package : myfaces-api in version : 1.2.7 from
> path : file:/home/scottallen/roadmap/rmths/WEB-INF/lib/myfaces-api-1.2.7.jar
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
> logMetaInf
> INFO: Starting up MyFaces-package : myfaces-impl in version : 1.2.7 from
> path :
> file:/home/scottallen/roadmap/rmths/WEB-INF/lib/myfaces-impl-1.2.7.jar
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
> logMetaInf
> INFO: MyFaces-package : tomahawk-sandbox15 not found.
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
> logMetaInf
> INFO: MyFaces-package : tomahawk-sandbox not found.
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
> logMetaInf
> INFO: Starting up MyFaces-package : tomahawk in version : 1.1.9 from path :
> file:/home/scottallen/roadmap/rmths/WEB-INF/lib/tomahawk-1.1.9.jar
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.shared_impl.util.LocaleUtils
> toLocale
> WARNING: Locale name in faces-config.xml null or empty, setting locale to
> default locale : en_US
> Jul 6, 2009 11:19:59 PM org.apache.myfaces.config.FacesConfigurator
> handleSerialFactory
> INFO: Serialization provider : class
> org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
>