myfaces-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Bill Lucy (JIRA)" <>
Subject [jira] [Created] (MYFACES-4010) MyFaces 2.2 throws UnsupportedOperationException with an eager ManagedBean with ManagedProperty
Date Wed, 19 Aug 2015 18:47:45 GMT
Bill Lucy created MYFACES-4010:

             Summary: MyFaces 2.2 throws UnsupportedOperationException with an eager ManagedBean
with ManagedProperty
                 Key: MYFACES-4010
             Project: MyFaces Core
          Issue Type: Bug
    Affects Versions: 2.2.8
         Environment: Tomcat, WebShere
            Reporter: Bill Lucy

This seems to be a regression from another issue,,
which was resolved in 2.0 and 2.1.

Given a bean similar to the following:

@ManagedBean(eager=true, name="eagerBean")
public class EagerBean implements Serializable {
	private static final long serialVersionUID = 1L;
	private MessageBean messageBean;

    public void postConstruct() {

The following exception is thrown with MyFaces 2.2.8 on Tomcat 8:
19-Aug-2015 12:48:32.443 SEVERE [localhost-startStop-1] org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces
An error occured while initializing MyFaces: This method is not supported during startup
 java.lang.UnsupportedOperationException: This method is not supported during startup
        at org.apache.myfaces.context.servlet.StartupServletExternalContextImpl.getSession(
        at org.apache.myfaces.view.impl.DefaultViewScopeHandler.generateViewScopeId(
        at org.apache.myfaces.view.ViewScopeProxyMap.getWrapped(
        at org.apache.myfaces.view.ViewScopeProxyMap.get(
        at org.apache.myfaces.config.ManagedBeanBuilder.getScope(
        at org.apache.myfaces.config.ManagedBeanBuilder.getNarrowestScope(
        at org.apache.myfaces.config.ManagedBeanBuilder.isInValidScope(
        at org.apache.myfaces.config.ManagedBeanBuilder.initializeProperties(
        at org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBean(
        at org.apache.myfaces.webapp.AbstractFacesInitializer._createEagerBeans(
        at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(
        at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(
        at org.apache.catalina.core.StandardContext.listenerStart(
        at org.apache.catalina.core.StandardContext.startInternal(

Note, the app does not throw this Exception in MyFaces 2.0.  The regression in 2.2 is caused
by a spec update to UIViewRoot.getViewMap(boolean): that map is now backed by the session,
which is not available during startup (which was addressed by MYFACES-3116):

One solution is to make sure we don't call getViewMap(true) during startup; I'll attach a
patch demonstrating that route.

This message was sent by Atlassian JIRA

View raw message