2

我想知道创建包含一些包含的新 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)
        ...
4

1 回答 1

3

终于在 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">
...

-->template="xyz.xhtml"包含上面的代码片段 --> 递归。

删除反正错误的模板属性解决了这个问题。最后,作为此问题症状的上述异常与错误原因相差甚远。决议一点也不明显。

于 2013-03-15T14:53:33.437 回答