You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by eface <es...@ncr.com> on 2006/06/15 23:23:05 UTC

MyFaces 1.1.4 is initialized twice in portlet.

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 

Here is my web.xml file

<?xml version="1.0" encoding="UTF-8"?>
<!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>My Messages Portlet</display-name>
  <description>My Messages Portlet</description>
  <context-param>
    <param-name>javax.faces.DEFAULT_SUFFIX</param-name>
    <param-value>.xhtml</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>facelets.LIBRARIES</param-name>
   <param-value>/WEB-INF/tld/tomahawk.taglib.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>contextConfigLocation</param-name>
    <param-value>/WEB-INF/applicationContext.xml</param-value>
  </context-param>

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

  <listener>
   
<listener-class>com.liferay.portal.shared.servlet.PortletContextListener</listener-class>
  </listener>

  <listener>
   
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
  </listener>

  <servlet>
    <servlet-name>MyMessages</servlet-name>
   
<servlet-class>com.liferay.portal.shared.servlet.PortletServlet</servlet-class>
    <init-param>
      <param-name>portlet-class</param-name>
      <param-value>com.teradata.portlet.MultiModePortlet</param-value>
    </init-param>
    <load-on-startup>0</load-on-startup>
  </servlet>

  <servlet>
    <servlet-name>FacesServlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>

  <servlet-mapping>
    <servlet-name>MyMessages</servlet-name>
    <url-pattern>/MyMessagesPortlet/*</url-pattern>
  </servlet-mapping>

  <taglib>
    <taglib-uri>http://java.sun.com/portlet</taglib-uri>
    <taglib-location>/WEB-INF/tld/liferay-portlet.tld</taglib-location>
  </taglib>

</web-app>

--
View this message in context: http://www.nabble.com/MyFaces-1.1.4-is-initialized-twice-in-portlet.-t1794773.html#a4890762
Sent from the MyFaces - Users forum at Nabble.com.


Re: MyFaces 1.1.4 is initialized twice in portlet.

Posted by eface <es...@ncr.com>.
http://issues.apache.org/jira/browse/MYFACES-1338.
--
View this message in context: http://www.nabble.com/MyFaces-1.1.4-is-initialized-twice-in-portlet.-t1794773.html#a4892541
Sent from the MyFaces - Users forum at Nabble.com.


Re: MyFaces 1.1.4 is initialized twice in portlet.

Posted by Matthias Wessendorf <ma...@apache.org>.
HEy,

can you open an issue on jira ([1]).

-Matthias

[1] http://issues.apache.org/jira/browse/MYFACES

On 6/15/06, eface <es...@ncr.com> wrote:
>
> 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.
>
> Is this is a configuration error on my part or an implementation oversight?
>
>
> Thanks!
> -Eric
>
> --
> View this message in context: http://www.nabble.com/MyFaces-1.1.4-is-initialized-twice-in-portlet.-t1794773.html#a4892250
> Sent from the MyFaces - Users forum at Nabble.com.
>
>


-- 
Matthias Wessendorf
Aechterhoek 18
48282 Emsdetten
blog: http://jroller.com/page/mwessendorf
mail: mwessendorf-at-gmail-dot-com

Re: MyFaces 1.1.4 is initialized twice in portlet.

Posted by eface <es...@ncr.com>.
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.

Is this is a configuration error on my part or an implementation oversight?


Thanks!
-Eric

--
View this message in context: http://www.nabble.com/MyFaces-1.1.4-is-initialized-twice-in-portlet.-t1794773.html#a4892250
Sent from the MyFaces - Users forum at Nabble.com.