日期:2014-05-16  浏览次数:20376 次

JSF项目打包

同事问我,JSF项目发布的时候,为什么编译后的类放在classes发布是没问题的,而打包成jar放到lib下就包null错误呢?

很是纠结了一阵后,我找到了答案:

https://javaserverfaces.dev.java.net/issues/show_bug.cgi?id=1693

Managed beans declared only via javax.faces.bean annotations, and packaged only in a jar file in WEB-
INF/lib are not discovered by the application.
MBean 使用注解方式声明 而不是声明在faces-config.xml 打包放在WEB-INF/lib里
MBean无法被应用正确发现。
The real problem here was user error.  My testcase.zip did not have a faces-config.xml in the META-INF in the jar.  When I added one, it worked.  However, the spec says an empty or zero-length one should be sufficient also.  This assertion failed.  The attached changebundle fixes the problem of a zero-length or empty faces-config.xml file in a META-INF in a jar in WEB-INF/lib causing the app to fail to deploy.

大概意思是:
jar包中,在META-INF里需要一个空的faces-config.xml文件