IBM Support

PI47578: An UnsupportedOperationException is thrown with an eager Managed Bean containing a ManagedProperty in JSF 2.2

Subscribe

You can track all active APARs for this component.

 

APAR status

  • Closed as program error.

Error description

  • Given a bean similar to the following:
    
    @ManagedBean(eager=true, name="eagerBean")
    @ApplicationScoped
    public class EagerBean implements Serializable
    {
    private static final long serialVersionUID = 1L;
    
    @ManagedProperty(value="#{message} ")
    private MessageBean messageBean;
    
    @PostConstruct
    public void postConstruct()
    { ... }
    ...
    }
    
    The following exception is thrown:
    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.StartupServletExternalCon
    textImpl.getSession(StartupServletExternalContextImpl.java:1
    87)
    at
    org.apache.myfaces.view.impl.DefaultViewScopeHandler.generat
    eViewScopeId(DefaultViewScopeHandler.java:128)
    at
    org.apache.myfaces.view.ViewScopeProxyMap.getWrapped(ViewSco
    peProxyMap.java:76)
    at
    org.apache.myfaces.view.ViewScopeProxyMap.get(ViewScopeProxy
    Map.java:109)
    at
    org.apache.myfaces.config.ManagedBeanBuilder.getScope(Manage
    dBeanBuilder.java:560)
    at
    org.apache.myfaces.config.ManagedBeanBuilder.getNarrowestSco
    pe(ManagedBeanBuilder.java:464)
    at
    org.apache.myfaces.config.ManagedBeanBuilder.isInValidScope(
    ManagedBeanBuilder.java:435)
    at
    org.apache.myfaces.config.ManagedBeanBuilder.initializePrope
    rties(ManagedBeanBuilder.java:319)
    at
    org.apache.myfaces.config.ManagedBeanBuilder.buildManagedBea
    n(ManagedBeanBuilder.java:163)
    at
    org.apache.myfaces.webapp.AbstractFacesInitializer._createEa
    gerBeans(AbstractFacesInitializer.java:303)
    at
    org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces
    (AbstractFacesInitializer.java:193)
    at
    org.apache.myfaces.webapp.StartupServletContextListener.cont
    extInitialized(StartupServletContextListener.java:119)
    at
    org.apache.catalina.core.StandardContext.listenerStart(Stand
    ardContext.java:4727)
    at
    org.apache.catalina.core.StandardContext.startInternal(Stand
    ardContext.java:5167)
    
    Note, the app does not throw this Exception in JSF 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):
    https://javaserverfaces.java.net/docs/2.2/javadocs/javax/fac
    es/component/UIViewRoot.html#getViewMap%28boolean%29
    
    This issue is resolved in
    https://issues.apache.org/jira/browse/MYFACES-4010
    

Local fix

Problem summary

  • ****************************************************************
    * USERS AFFECTED:  IBM WebSphere Application Server Liberty    *
    *                  Profile version 8.5.5 users of JavaServer   *
    *                  Faces (JSF) MyFaces 2.2                     *
    ****************************************************************
    * PROBLEM DESCRIPTION: A                                       *
    *                      java.lang.UnsupportedOperationException *
    *                      is thrown when a JSF ManagedBean        *
    *                      containing a ManagedProperty is defined *
    *                      as eager                                *
    ****************************************************************
    * RECOMMENDATION:                                              *
    ****************************************************************
    A JSF ManagedBean defined as eager and containing a
    ManagedProperty will generate an UnsupportedOperationException;
    an example of a problematic ManagedBean is presented below:
    
    @ManagedBean(eager=true, name="eagerBean")
    @ApplicationScoped
    public class EagerBean implements Serializable
    {
    private static final long serialVersionUID = 1L;
    
    @ManagedProperty(value="#{message} ")
    private MessageBean messageBean;
    
    @PostConstruct
    public void postConstruct() {
     ... }
    ...
    }
    
    The following exception will be thrown by JSF MyFaces 2.2:
    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.StartupServletExternalContext
    Impl.getSession(StartupServletExternalContextImpl.java:187)
    at
    org.apache.myfaces.view.impl.DefaultViewScopeHandler.generateVie
    wScopeId(DefaultViewScopeHandler.java:128)
    at
    org.apache.myfaces.view.ViewScopeProxyMap.getWrapped(ViewScopePr
    oxyMap.java:76)
    at
    org.apache.myfaces.view.ViewScopeProxyMap.get(ViewScopeProxyMap.
    java:109)
    at
    org.apache.myfaces.config.ManagedBeanBuilder.getScope(ManagedBea
    nBuilder.java:560)
    ...
    

Problem conclusion

  • The JSF MyFaces 2.2 ManagedBean code was updated to avoid
    performing invalid operations during application startup.
    
    The fix for this APAR is currently targeted for inclusion in fix
    pack 8.5.5.8.  Please refer to the Recommended Updates page for
    delivery information:
    http://www.ibm.com/support/docview.wss?rs=180&uid=swg27004980
    

Temporary fix

Comments

APAR Information

  • APAR number

    PI47578

  • Reported component name

    WAS LIBERTY COR

  • Reported component ID

    5725L2900

  • Reported release

    855

  • Status

    CLOSED PER

  • PE

    NoPE

  • HIPER

    NoHIPER

  • Special Attention

    NoSpecatt / Xsystem

  • Submitted date

    2015-08-26

  • Closed date

    2015-09-04

  • Last modified date

    2015-09-04

  • APAR is sysrouted FROM one or more of the following:

  • APAR is sysrouted TO one or more of the following:

Fix information

  • Fixed component name

    WAS LIBERTY COR

  • Fixed component ID

    5725L2900

Applicable component levels

  • R855 PSY

       UP

[{"Business Unit":{"code":"BU059","label":"IBM Software w\/o TPS"},"Product":{"code":"SSD28V","label":"WebSphere Application Server Liberty Core"},"Platform":[{"code":"PF025","label":"Platform Independent"}],"Version":"855","Line of Business":{"code":"LOB45","label":"Automation"}}]

Document Information

Modified date:
28 April 2022