@PostConstruct Weblogic上标注10.3.4不会被调用 [英] @PostConstruct annotation on Weblogic 10.3.4 not being called
问题描述
(这似乎的重复<一href=\"http://stackoverflow.com/questions/5862085/weblogic10-3-ignores-postconsturt-method\">Weblogic10.3忽略@PostConsturt方法。,但有小细节并没有回答)。
(This seems a duplicate of Weblogic10.3 ignores @PostConsturt method., but that has little details and is not answered).
我有这样一个ManagedBean:
I have a ManagedBean like this:
public class TestBean {
private String greeting = "Hello, World!";
public TestBean() {
}
public String getGreeting() {
System.out.println( "getGreeting called, returning " + this.greeting );
return greeting;
}
public void setGreeting( String message ) {
this.greeting = message;
}
@PostConstruct
public void prepareSomething() {
System.out.println( "\n\nPostConstruct called.\n\n" );
this.greeting += " (PostConstruct was called)";
}
}
在我的XHTML,我只是豆消息:#{TestBean.greeting}
。访问页面的时候,但是,该方法不叫,什么我得到的是
and in my xhtml, I have simply Bean Message: #{TestBean.greeting}
. When accessing the page, however, the method is not called, and what I get is
Bean Message: Hello, World!
而不是预期的
Bean Message: Hello, World! (PostConstruct was called)
Console会显示系统输出的从 getGreeting()
方法,而不是从 prepareSomething()
:
INFO: Added Library from: zip:/data/java/wl1034/user_projects/domains/wlrep1034/autodeploy/PCTest.ear/PCTest.war/WEB-INF/lib/jsf-facelets.jar!/META-INF/jstl-fn.taglib.xml
getGreeting called, returning Hello, World!
2011-05-12 10:36:11,720 DEBUG org.richfaces.skin.SkinFactoryImpl - Create new Skin instance for name DEFAULT
进一步信息:我使用JSF 1.2(使用的Weblogic 10.3.4的 MW_HOME /普通/部署-库/ JSF的1.2.war罐子/ WEB-INF / lib目录
),Facelets的1.1.14,RichFaces的3.3.2。我对 WEB-INF / lib目录下的jar
:
Further info: I am using JSF 1.2 (using the jars from Weblogic 10.3.4's MW_HOME/common/deployable-libs/jsf-1.2.war!/WEB-INF/lib
), Facelets 1.1.14, RichFaces 3.3.2. I have the following jars on WEB-INF/lib
:
commons-beanutils-1.7.0.jar
commons-digester-1.8.jar
commons-logging-1.1.1.jar
glassfish.jsf_1.0.0.0_1-2-15.jar
glassfish.jstl_1.2.0.1.jar
javax.jsf_1.1.0.0_1-2.jar
jsf-facelets.jar
log4j-1.2.16.jar
richfaces-api-3.3.2.SR1.jar
richfaces-impl-3.3.2.SR1.jar
richfaces-ui-3.3.2.SR1.jar
SimpleJSF.jar
wls.jsf.di.jar
我曾尝试拨打/删除注释-api.jar文件
为好,相同的症状。
我可能会在必要时发布的其他文件。
I may post other files if necessary.
推荐答案
我不使用Weblogic的,但如果我没有错,Weblogic的已经附带了自己的JSTL / JSF库。所以,你不需要自己在所有提供给他们。
I don't use Weblogic, but if I am not wrong, Weblogic already ships with its own JSTL/JSF libraries. So you don't need to supply them yourself at all.
但是,如果我错了,Weblogic的不跟他们出货,那么这些库看起来不完全正确。究竟那些是什么版本?
But if I am wrong and Weblogic don't ship with them, then those libraries doesn't look quite right. What versions exactly are those?
glassfish.jsf_1.0.0.0_1-2-15.jar
glassfish.jstl_1.2.0.1.jar
javax.jsf_1.1.0.0_1-2.jar
的 @PostConstruct
适用于JSF 1.2或更高版本而已。你可以在这里下载 JSF 1.2 。它存在两个JAR文件
The @PostConstruct
works on JSF 1.2 or newer only. You can download JSF 1.2 here. It exist of two JAR files
jsf-api.jar
jsf-impl.jar
您只需要确保你的 faces-config.xml中
声明符合JSF 1.2规范并且也是的web.xml
声明符合至少的Servlet 2.5规范。
You only need to ensure that your faces-config.xml
is declared conform JSF 1.2 specification and also that web.xml
is declared conform at least Servlet 2.5 specification.
最后,JSTL库应该这个。
Finally, the JSTL library should be this one.
这篇关于@PostConstruct Weblogic上标注10.3.4不会被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!