【发布时间】:2014-12-10 16:51:50
【问题描述】:
我刚刚尝试在 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 为空?这个堆栈有什么特别的吗,还是我必须配置任何其他属性?
非常感谢您的帮助!
托马斯
【问题讨论】: