我不知道我做錯了,請幫忙:的Tomcat 7,JSF 2.0和@PostConstruct
- 新鮮的Tomcat 7的/ lib文件夾
- 簡單的網絡應用程序,沒有額外的罐子鑽嘴魚科2.0.3庫在WEB-INF/lib目錄(JSF-api.jar中,JSF-impl.jar中)
- 做工精細,除了@PostConstruct在我的豆子 - 他們不是在所有
日誌稱爲:
個Mar 12, 2011 11:19:54 PM org.apache.catalina.startup.HostConfig deployWAR
INFO: Deploying web application archive test_web_app.war
Mar 12, 2011 11:19:54 PM com.sun.faces.config.ConfigureListener contextInitialized
INFO: Initializing Mojarra 2.0.3 (FCS b03) for context '/test_web_app'
Mar 12, 2011 11:19:54 PM com.sun.faces.spi.InjectionProviderFactory createInstance
INFO: JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
的web.xml
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<servlet>
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>/faces/*</url-pattern>
</servlet-mapping>
</web-app>
faces-config.xml中
<faces-config xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-facesconfig_2_0.xsd"
version="2.0">
</faces-config>
豆與可達方法:
@ManagedBean
@ApplicationScoped
public class AppBean {
@PostConstruct
public void test() {
throw new RuntimeException("test");
}
}
這就是全部。有任何想法嗎?
整個堆棧跟蹤將有所幫助。隨着一些Google的快速搜索,我懷疑這不是問題。 –
@Brian Roach,實際上整個堆棧是'2011年3月12日11:19:54 com.sun.faces.config.ConfigureListener contextInitialized 信息:初始化上下文的Mojarra 2.0.3(FCS b03)'/ test_web_app' '之前,我提到 – Osw