Uploaded image for project: 'MyFaces Core'
  1. MyFaces Core
  2. MYFACES-1338

MyFaces is initialized twice in Portlet

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Won't Fix
    • 1.1.4-SNAPSHOT
    • None
    • Portlet_Support
    • None
    • Windows XP / Tomcat 5.5.17 / Liferay 4.0.0.

    Description

      I'm using MyFaces 1.1.4 within a portlet and I'm noticing that MyFaces is being initialized twice. Its causing a warning because multiple copies of my managed beans are being created. Here is the log output, I'm using Liferay 4.0.0 and tomcat 5.5.17.

      20:52:52,517 INFO [com.liferay.portal.deploy.AutoDeployPortletListener] Portlets for \home\liferay\deploy\MyMessagesPortlet.war copied successfully
      20:53:00,122 INFO [org.apache.catalina.startup.HostConfig] Reloading context [/MyMessagesPortlet]
      DEBUG [org.apache.myfaces.webapp.StartupServletContextListener.initFaces(60)] Initializing MyFaces
      INFO [org.apache.myfaces.config.FacesConfigurator.feedStandardConfig(151)] Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
      INFO [org.apache.myfaces.config.FacesConfigurator.feedClassloaderConfigurations(250)] Reading config jar:file:/D:/liferay4/webapps/MyMessagesPortlet/WEB-INF/lib/jsf-facelets.jar!/META-INF/faces-config.xml
      INFO [org.apache.myfaces.config.FacesConfigurator.feedClassloaderConfigurations(250)] Reading config jar:file:/D:/liferay4/webapps/MyMessagesPortlet/WEB-INF/lib/tomahawk-1.1.2-SNAPSHOT.jar!/META-INF/faces-config.xml
      INFO [org.apache.myfaces.config.FacesConfigurator.feedWebAppConfig(411)] Reading config /WEB-INF/faces-config.xml
      INFO [org.apache.myfaces.renderkit.html.HtmlRenderKitImpl.addRenderer(104)] Overwriting renderer with family = javax.faces.Command rendererType = javax.faces.Button renderer class = org.apache.myfaces.renderkit.html.jsf.DummyFormHtmlButtonRenderer
      INFO [org.apache.myfaces.renderkit.html.HtmlRenderKitImpl.addRenderer(104)] Overwriting renderer with family = javax.faces.Command rendererType = javax.faces.Link renderer class = org.apache.myfaces.renderkit.html.jsf.DummyFormHtmlLinkRenderer
      INFO [org.apache.myfaces.webapp.StartupServletContextListener.initFaces(96)] ServletContext 'D:\liferay4\webapps\MyMessagesPortlet\' initialized.
      20:53:02,575 INFO [com.liferay.portal.deploy.HotDeployPortletListener] Registering portlets for MyMessagesPortlet
      20:53:02,606 INFO [com.liferay.portal.deploy.HotDeployPortletListener] Portlets for MyMessagesPortlet registered successfully
      Loading jar:file:/D:/liferay4/liferay/WEB-INF/lib/portal-ejb.jar!/portal.properties for liferay.com
      Loading file:/D:/liferay4/liferay/WEB-INF/classes/portal-ext.properties for liferay.com
      Loading jar:file:/D:/liferay4/liferay/WEB-INF/lib/portal-ejb.jar!/cache-single-vm.properties
      DEBUG [com.teradata.portlet.MultiModePortlet.init(32)] View page = /view.xhtml
      DEBUG [com.teradata.portlet.MultiModePortlet.init(33)] Edit page = /edit.xhtml
      DEBUG [com.teradata.portlet.MultiModePortlet.init(34)] Help page = /help.xhtml
      DEBUG [org.apache.myfaces.portlet.MyFacesGenericPortlet.initMyFaces(178)] Initializing MyFaces
      INFO [org.apache.myfaces.config.FacesConfigurator.feedStandardConfig(151)] Reading standard config org/apache/myfaces/resource/standard-faces-config.xml
      INFO [org.apache.myfaces.config.FacesConfigurator.feedClassloaderConfigurations(250)] Reading config jar:file:/D:/liferay4/webapps/MyMessagesPortlet/WEB-INF/lib/jsf-facelets.jar!/META-INF/faces-config.xml
      INFO [org.apache.myfaces.config.FacesConfigurator.feedClassloaderConfigurations(250)] Reading config jar:file:/D:/liferay4/webapps/MyMessagesPortlet/WEB-INF/lib/tomahawk-1.1.2-SNAPSHOT.jar!/META-INF/faces-config.xml
      INFO [org.apache.myfaces.config.FacesConfigurator.feedWebAppConfig(411)] Reading config /WEB-INF/faces-config.xml
      INFO [org.apache.myfaces.renderkit.html.HtmlRenderKitImpl.addRenderer(104)] Overwriting renderer with family = javax.faces.Command rendererType = javax.faces.Button renderer class = org.apache.myfaces.renderkit.html.jsf.DummyFormHtmlButtonRenderer
      INFO [org.apache.myfaces.renderkit.html.HtmlRenderKitImpl.addRenderer(104)] Overwriting renderer with family = javax.faces.Command rendererType = javax.faces.Link renderer class = org.apache.myfaces.renderkit.html.jsf.DummyFormHtmlLinkRenderer
      INFO [org.apache.myfaces.renderkit.RenderKitFactoryImpl.addRenderKit(54)] RenderKit with renderKitId 'HTML_BASIC' was replaced.
      WARN [org.apache.myfaces.config.FacesConfigurator.configureRuntimeConfig(588)] More than one managed bean w/ the name of 'messages' - only keeping the last
      WARN [org.apache.myfaces.config.FacesConfigurator.configureRuntimeConfig(588)] More than one managed bean w/ the name of 'form' - only keeping the last

      Both org.apache.myfaces.webapp.StartupServletContextListener.initMyFaces() and org.apache.myfaces.portlet.MyFacesGenericPortlet.initMyFaces() check a context attribute to see if MyFaces is initialized before invoking org.apache.myfaces.config.FacesConfigurator.configure() but both actually check and set a different attribute name.

      StartupServletContextListener uses:

      static final String FACES_INIT_DONE
      = StartupServletContextListener.class.getName() + ".FACES_INIT_DONE";

      MyFacesGenericPortlet uses:

      protected static final String FACES_INIT_DONE =
      MyFacesGenericPortlet.class.getName() + ".FACES_INIT_DONE";

      I find that if I override MyFacesGenericPortlet.initMyFaces() to do nothing, everythings works and I avoid the duplicate managed bean warnings.

      Attachments

        Issue Links

          Activity

            People

              mmarinschek Martin Marinschek
              escheie Eric Scheie
              Votes:
              5 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: