【问题标题】:JSF ViewDeclarationLanguage is null, when using Weld on Glassfish 3.1.2在 Glassfish 3.1.2 上使用 Weld 时,JSF ViewDeclarationLanguage 为空
【发布时间】: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 为空?这个堆栈有什么特别的吗,还是我必须配置任何其他属性?

非常感谢您的帮助!

托马斯

【问题讨论】:

    标签: jsf glassfish weld


    【解决方案1】:

    我自己找到了解决方案,但如果其他人遇到同样的问题,我想分享它。

    在 faces-config 中,有一个自定义视图处理程序的定义。这个视图处理程序没有正确处理这个请求,所以我把它改成了“org.jboss.weld.jsf.ConversationAwareViewHandler”。

    现在可以了!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-09-22
      • 2015-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-02-18
      相关资源
      最近更新 更多