0

Java version: 1.8.0_102; Mojarra: 2.3.0; Primefaces: 6.1.RC2 (community edition);

It's always nice when you can genuinely refer to a 'StackOverflow` on Stackoverflow.

I have not yet isolated this as a dedicated test case, and the XHTML/JSF code is far too complex to reproduce here (being the reason I used ui:include) but I can at least describe it so that if somebody else encounters the same strange problem they know where to look.

I have two composite components, let's call them A and B.

They both involve very large complex p:dataTable, but slightly different, yet share exactly many of the p:column. So for the sake of Don't Repeat Yourself (DRY) coding I used a ui:include of the multiple p:column into both of the 2 separate CCs, A and B.

This worked fine for a couple of days. I kept working on the mutually included section, introducing new p:column columns, then suddenly started getting StackOverflowError errors:

java.lang.StackOverflowError
at com.sun.el.lang.EvaluationContext.getContext(EvaluationContext.java:91)
at com.sun.faces.el.ImplicitObjectELResolver.getValue(ImplicitObjectELResolver.java:110)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:180)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:208)
at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:116)
at com.sun.el.parser.AstValue.getBase(AstValue.java:151)
at com.sun.el.parser.AstValue.getValue(AstValue.java:200)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.ContextualCompositeValueExpression.getValue(ContextualCompositeValueExpression.java:159)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:115)
at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:2487)
at com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap.get(CompositeComponentAttributesELResolver.java:405)
at javax.el.MapELResolver.getValue(MapELResolver.java:199)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:180)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:208)
at com.sun.el.parser.AstValue.getValue(AstValue.java:140)
at com.sun.el.parser.AstValue.getValue(AstValue.java:204)
at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:226)
at org.jboss.weld.el.WeldValueExpression.getValue(WeldValueExpression.java:50)
at com.sun.faces.facelets.el.ContextualCompositeValueExpression.getValue(ContextualCompositeValueExpression.java:159)
at com.sun.faces.facelets.el.TagValueExpression.getValue(TagValueExpression.java:115)
at javax.faces.component.UIComponentBase$AttributesMap.get(UIComponentBase.java:2487)
at com.sun.faces.el.CompositeComponentAttributesELResolver$ExpressionEvalMap.get(CompositeComponentAttributesELResolver.java:405)
at javax.el.MapELResolver.getValue(MapELResolver.java:199)
at com.sun.faces.el.DemuxCompositeELResolver._getValue(DemuxCompositeELResolver.java:180)
at com.sun.faces.el.DemuxCompositeELResolver.getValue(DemuxCompositeELResolver.java:208)
at com.sun.el.parser.AstValue.getValue(AstValue.java:140)
at com.sun.el.parser.AstValue.getValue(AstValue.java:204)

I scratched my head (but not enough to go bald) looking for what could be the cause, and convinced myself there was nothing that would cause recursion.

Then I thought to simply comment out the ui:include from both "client" CCs, A and B, and paste the complex multiple-column p:column code back into A, and it all worked fine. I then pasted it also into B, and it still worked fine.

It's reproducible. Something about using the ui:include across the multiple p:column is throwing it, and I could not yet find out what (the culprit included code looks innocent to me, but as said, way too complex to show here).

A crying shame, as the ui:include included code is very complex, and reproducing/editing/managing it it in two different CC contexts is labourious and horribly WET (Write Everything Twice, a.k.a. We Enjoy Typing).

Q1: Can anyone think of anything that could cause this ?

Q2: Is there anyway to encapsulate just the p:column aspect of multiple columns within a p:dataTable as a composite component ?

I would be surprised if anybody can answer Q1 without some tricky testing. It's a pathological gotcha.

I would be very suprised if there is a solution to Q2.

Will try to isolate it as a test case, but for now the questions stand as described.

  • With the stacktrace you put here it is impossible to know where it comes from. You need to put the full stacktrace from top to end. If this is only what you get you need to change the log levels of your application server and/or application... – onderbewustzijn Nov 17 '17 at 14:24
  • Very long question indeed, try to make it shorter and describe well your components. you are trying to re-use the p:column "definitions" of your table into another table is that the case ? – Jalal Sordo Nov 17 '17 at 16:00
  • @JalalSordo Not 're-use the `p:column` ... into another table', they are included, using `ui:include`, into 2 separate tables, each within a composite component. (Within the included code segment they are just `p:column`) – Webel IT Australia - upvoter Nov 19 '17 at 09:21

0 Answers0