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?
@PostConstructon JSF artifacts whenever the JSF libraries are supplied along with the web application (in the/WEB-INF/libfolder) instead of that the web application uses Weblogic's own supplied JSF libraries. - BalusCWEB-INF/lib, you are instructed to use the application server. Weblogic 12c gives me JSF libraries now (and these are what I use) to avoid problems that occurred in previous versions of weblogic (10.3g and 11g). I also do test, adding to libraries inWEB-INF/lib, and no good result was observed. - Adam M. Gamboa G.