Frage

In summary, method with @PostConstruct is not call by JSF on WebLogic12c, on managed bean.

I have a very basic application.

Technologies used: JSF2.0

Application Server: WebLogic 12c

Java

@ManagedBean
@ViewScoped

public class BeanTest implements Serializable {

    private String hola_mundo = "";

    public BeanTest(){
        this.init();
    }

    private void init(){
        hola_mundo +=" Enter to construct - ";
    }


    @PostConstruct
    public void initPostConstruct(){
        hola_mundo +=" Enter to PostConstruct - ";
    }

    public String getHola_mundo() {
        return hola_mundo;
    }

    public void setHola_mundo(String hola_mundo) {
        this.hola_mundo = hola_mundo;
    }
}

XHTML

<h:head>
    <title>Facelet Title</title>
</h:head>
<h:body>
    Test
    <br/>
    #{beanTest.hola_mundo}
</h:body>

When the managed bean is instance for JSF, The managed bean beanTest is create, (Enter at normal constructor) but don't enter (ignore, don't call) method with PostConstruct.

The text displayed with WebLogic: Enter to Construct The expected text, but not displayed with WL: Enter to Construct - Enter to PostConstruct

The application has been deployed on other application servers:

  • GlassFish 3.1.1
  • GlassFish 3.1.2
  • Tomcat 7.0.22

And show the expected result.

The problem only happens with JSF managed beans(request, session, view, application), if use CDI, the PostConstruct is called. But I need to use the JSF ViewScoped annotation.

Someone with any idea?

War es hilfreich?

Lösung

Well, the problem is solved.

This is a bug reported, and already has a patch.

Bug: 13703600
Patch : SU Patch [UXPH]: WLS12C - POSTCONSTRUCT NOT CALLED ON @MANAGEDBEAN BEANS IN JSF APP.

I apply the patch and the problem was fixed...

Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit StackOverflow
scroll top