Weblogic 12c Does Not Call Postconstruct Methods Of Jsf 2.0 Managed Beans (Doc ID 1414700.1)

Last updated on JUNE 09, 2016

Applies to:

Oracle Weblogic Server - Version 12.1.1.0 to 12.1.1.0 [Release 12c]
Information in this document applies to any platform.

Symptoms

WebLogic 12c (12.1.1) does not call the PostConstruct method for beans annotated with @ManagedBean when there is a beans.xml file in the project.  As soon as the beans.xml file is removed, the PostConstruct method is invoked.

However, this means that WebLogic 12c does not support projects that have both ManagedBeans and CDI beans (even if they never reference eachother).


Sample code snippets -

package sample.test.web;

import javax.annotation.PostConstruct;
import javax.faces.bean.ManagedBean;

@ManagedBean
public class WebPageBean {

  public WebPageBean() {
    System.out.println("construct");
  }

  @PostConstruct
  public void setup() {
    System.out.println("setup");  // this does not get called when beans.xml exists in project
  }

  public String getProp() {
     return "Hello";
  }
}

 

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms