Apache MyFaces:VariableMapperWrapper.resolveVariable,StackOverflowError:无法解析变量[溢出]

时间:2013-03-15 14:08:01

标签: jsf-2 facelets

我想知道这个异常创建包含一些包含的新Facelets的原因是什么。 EL分辨率内部显然存在递归。 VariableMapperWrapper.resolveVariable方法的调试没有显示任何特殊内容:EL分辨率正在发生......

14.03.2013 17:20:13 org.apache.catalina.core.StandardWrapperValve invoke
SCHWERWIEGEND: Servlet.service() for servlet Faces Servlet threw exception
java.lang.StackOverflowError
        at java.lang.AbstractStringBuilder.append(AbstractStringBuilder.java:390)
        at java.lang.StringBuilder.append(StringBuilder.java:119)
        at org.apache.myfaces.view.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:96)
        at org.apache.myfaces.view.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:89)
        at org.apache.myfaces.view.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:89)
             ... (recursion) ...
        at org.apache.myfaces.view.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:89)
        at org.apache.myfaces.view.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:89)
        at org.apache.myfaces.view.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:89)
        at org.apache.myfaces.view.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:89)
        at com.sun.el.lang.VariableMapperFactory.resolveVariable(VariableMapperFactory.java:63)
        at com.sun.el.lang.ExpressionBuilder.visit(ExpressionBuilder.java:234)
        at com.sun.el.parser.SimpleNode.accept(SimpleNode.java:172)
        at com.sun.el.parser.SimpleNode.accept(SimpleNode.java:175)
        at com.sun.el.lang.ExpressionBuilder.prepare(ExpressionBuilder.java:186)
        at com.sun.el.lang.ExpressionBuilder.build(ExpressionBuilder.java:197)
        at com.sun.el.lang.ExpressionBuilder.createValueExpression(ExpressionBuilder.java:240)
        at com.sun.el.ExpressionFactoryImpl.createValueExpression(ExpressionFactoryImpl.java:98)
        at org.apache.myfaces.view.facelets.tag.TagAttributeImpl.getValueExpression(TagAttributeImpl.java:486)
        at org.apache.myfaces.view.facelets.tag.jsf.ValueHolderRule$DynamicValueExpressionMetadata.applyMetadata(ValueHolderRule.java:99)
        at org.apache.myfaces.view.facelets.tag.MetadataImpl.applyMetadata(MetadataImpl.java:45)
        at javax.faces.view.facelets.MetaTagHandler.setAttributes(MetaTagHandler.java:66)
        at javax.faces.view.facelets.DelegatingMetaTagHandler.setAttributes(DelegatingMetaTagHandler.java:93)
        at org.apache.myfaces.view.facelets.tag.jsf.ComponentTagHandlerDelegate.apply(ComponentTagHandlerDelegate.java:237)
        at javax.faces.view.facelets.DelegatingMetaTagHandler.apply(DelegatingMetaTagHandler.java:53)
        at javax.faces.view.facelets.CompositeFaceletHandler.apply(CompositeFaceletHandler.java:49)
        ...

1 个答案:

答案 0 :(得分:2)

最终出现了Facelets XHTML代码中有一种特殊类型的递归。我注意到其他人通过包含像a.xhtml包含b.xhtml包含a.xhtml的片段链来创建这样的递归

在我的情况下,附带的代码段包含来自主XHTML页面的代码段和粘贴错误,代码段标题部分:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:f="http://java.sun.com/jsf/core"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:ui="http://java.sun.com/jsf/facelets">
<ui:composition template="xyz.xhtml">
...

- &GT; template="xyz.xhtml"包含上面的代码段 - &gt;递归。

删除无论如何错误的模板属性解决了问题。最后,作为此问题症状的上述异常与错误原因相差甚远。决议并不明显。