我只是尝试在glassfish 3.1.2上的焊接项目中添加一个复合JSF组件。 这总是因空指针异常而失败。 我追查了问题,发现它是由类中的以下代码产生的 com.sun.faces.application.ApplicationImpl。
@Override
public UIComponent [More ...] createComponent(FacesContext context, Resource componentResource) throws FacesException {
// RELEASE_PENDING (rlubke,driscoll) this method needs review.
Util.notNull("context", context);
Util.notNull("componentResource", componentResource);
UIComponent result = null;
// use the application defined in the FacesContext as we may be calling
// overriden methods
Application app = context.getApplication();
ViewDeclarationLanguage pdl = app.getViewHandler().getViewDeclarationLanguage(context, context.getViewRoot().getViewId());
BeanInfo componentMetadata = pdl.getComponentMetadata(context, componentResource);
....
问题似乎是,ViewDeclarationLanguage pdl结果为null,因此调用getComponentMetadata(...)会导致NPE。
问题是,为什么这个ViewDeclarationLanguage为null?这个堆栈中有什么特别之处,还是我必须配置任何其他属性?
非常感谢你的帮助!
托马斯
答案 0 :(得分:0)
我自己找到了解决方案,但是如果其他人偶然发现同样的问题,我想分享一下。
在faces-config中,有一个自定义视图处理程序的定义。此视图处理程序未正确处理此请求,因此我将其更改为“org.jboss.weld.jsf.ConversationAwareViewHandler”。
现在有效!