Forum Stats

  • 3,875,502 Users
  • 2,266,930 Discussions
  • 7,912,239 Comments

Discussions

Taglib not found within EL in CustomComponent with Mojarra 2.2.14

birnbuazn
birnbuazn Member Posts: 1
edited Nov 25, 2016 3:04AM in JavaServer Faces

Hint: I already posted a question about this on Stackoverflow: jsf - Omnifaces Taglib not found within EL in CustomComponent - Stack Overflow

I am currently upgrading a webapp from JBoss 7.1 to Wildfly 10.1, where I stumbled over a rather tricky problem concerning taglib resolution within an expression language within a custom component.

I managed to isolate the problem, which apparently boils down to the fact, that JSFs ExpressionBuilder cannot find the correct name spaces defined in my custom component and therefore complains that it does not know anything about the Omnifaces taglib:

<span class="pln" style="color: #303336;">javax</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ELException</span><span class="pun" style="color: #303336;">:</span><span class="pln" style="color: #303336;"> </span><span class="typ" style="color: #2b91af;">Function</span><span class="pln" style="color: #303336;"> </span><span class="str" style="color: #7d2727;">'of:format1'</span><span class="pln" style="color: #303336;"> </span><span class="kwd" style="color: #101094;">not</span><span class="pln" style="color: #303336;"> found <br/>at com</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">sun</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">lang</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ExpressionBuilder</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">visit</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">ExpressionBuilder</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">275</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at com</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">sun</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">parser</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">SimpleNode</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">accept</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">SimpleNode</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">172</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at com</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">sun</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">lang</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ExpressionBuilder</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">prepare</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">ExpressionBuilder</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">227</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at com</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">sun</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">lang</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ExpressionBuilder</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">build</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">ExpressionBuilder</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">238</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at com</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">sun</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">lang</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ExpressionBuilder</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">createValueExpression</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">ExpressionBuilder</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">295</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at com</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">sun</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ExpressionFactoryImpl</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">createValueExpression</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">ExpressionFactoryImpl</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">112</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at org</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">jboss</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">weld</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">util</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ForwardingExpressionFactory</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">createValueExpression</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">ForwardingExpressionFactory</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">53</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at org</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">jboss</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">weld</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">WeldExpressionFactory</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">createValueExpression</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">WeldExpressionFactory</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">48</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at org</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">jboss</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">weld</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">util</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ForwardingExpressionFactory</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">createValueExpression</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">ForwardingExpressionFactory</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">53</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at org</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">jboss</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">weld</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">WeldExpressionFactory</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">createValueExpression</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">WeldExpressionFactory</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">48</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> <br/>at com</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">sun</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">faces</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">facelets</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ELText</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">parse</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">ELText</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">411</span><span class="pun" style="color: #303336;">)</span><span class="pln" style="color: #303336;"> at com</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">sun</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">faces</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">facelets</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">el</span><span class="pun" style="color: #303336;">.</span><span class="typ" style="color: #2b91af;">ELText</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">parse</span><span class="pun" style="color: #303336;">(</span><span class="typ" style="color: #2b91af;">ELText</span><span class="pun" style="color: #303336;">.</span><span class="pln" style="color: #303336;">java</span><span class="pun" style="color: #303336;">:</span><span class="lit" style="color: #7d2727;">342</span><span class="pun" style="color: #303336;">)</span>

Funny enough, that only happens if I inline the evaluation of a nested EL expression within of:format1.

A minimal example, where the problem can be reproduced, can be found at a Bitbucket repository, but here's the relevant code of my custom component:

<span class="pun" style="color: #303336;"><?</span><span class="pln" style="color: #303336;">xml version</span><span class="pun" style="color: #303336;">=</span><span class="str" style="color: #7d2727;">"1.0"</span><span class="pln" style="color: #303336;"> encoding</span><span class="pun" style="color: #303336;">=</span><span class="str" style="color: #7d2727;">"UTF-8"</span><span class="pun" style="color: #303336;">?></span><span class="pln" style="color: #303336;"> <br/></span><span class="tag" style="color: #7d2727;"><html</span><span class="pln" style="color: #303336;"> </span><span class="atn" style="color: #e64320;">xmlns</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;"><span>"</span><a class="jive-link-external-small" href="http://www.w3.org/1999/xhtml" rel="nofollow">http://www.w3.org/1999/xhtml</a><span>"</span></span><span class="pln" style="color: #303336;"> <br/>      </span><span class="atn" style="color: #e64320;">xmlns:h</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;"><span>"</span><a class="jive-link-external-small" href="http://java.sun.com/jsf/html" rel="nofollow">http://java.sun.com/jsf/html</a><span>"</span></span><span class="pln" style="color: #303336;"> <br/>      </span><span class="atn" style="color: #e64320;">xmlns:c</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;"><span>"</span><a class="jive-link-external-small" href="http://java.sun.com/jsp/jstl/core" rel="nofollow">http://java.sun.com/jsp/jstl/core</a><span>"</span></span><span class="pln" style="color: #303336;"> <br/>      </span><span class="atn" style="color: #e64320;">xmlns:cc</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;"><span>"</span><a class="jive-link-external-small" href="http://xmlns.jcp.org/jsf/composite" rel="nofollow">http://xmlns.jcp.org/jsf/composite</a><span>"</span></span><span class="pln" style="color: #303336;"> <br/>      </span><span class="atn" style="color: #e64320;">xmlns:of</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;"><span>"</span><a class="jive-link-external-small" href="http://omnifaces.org/functions" rel="nofollow">http://omnifaces.org/functions</a><span>"</span></span><span class="tag" style="color: #7d2727;">></span><span class="pln" style="color: #303336;">  <br/></span><span class="tag" style="color: #7d2727;"> <h:head><br/></span><span class="pln" style="color: #303336;">  </span><span class="tag" style="color: #7d2727;"><title></span><span class="pln" style="color: #303336;">Testing EL</span><span class="tag" style="color: #7d2727;"></title></span><span class="pln" style="color: #303336;"> <br/></span><span class="tag" style="color: #7d2727;"> </h:head><br/></span><span class="pln" style="color: #303336;"></span><span class="tag" style="color: #7d2727;"> <h:body><br/></span><span class="pln" style="color: #303336;">  </span><span class="tag" style="color: #7d2727;"><cc:interface><br/></span><span class="pln" style="color: #303336;">   </span><span class="tag" style="color: #7d2727;"><cc:attribute</span><span class="pln" style="color: #303336;"> </span><span class="atn" style="color: #e64320;">name</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;">"model"</span><span class="pln" style="color: #303336;"> </span><span class="atn" style="color: #e64320;">type</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;">"sandbox.eltest.model.Entity"</span><span class="pln" style="color: #303336;"> </span><span class="atn" style="color: #e64320;">required</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;">"true"</span><span class="pln" style="color: #303336;"> </span><span class="tag" style="color: #7d2727;">/><br/></span><span class="pln" style="color: #303336;">  </span><span class="tag" style="color: #7d2727;"></cc:interface></span><span class="pln" style="color: #303336;">  <br/>  </span><span class="tag" style="color: #7d2727;"><cc:implementation><br/> </span><span class="pln" style="color: #303336;">  </span><span class="tag" style="color: #7d2727;"><div</span><span class="pln" style="color: #303336;"> </span><span class="atn" style="color: #e64320;">id</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;">"#{cc.clientId}"</span><span class="tag" style="color: #7d2727;">></span><span class="pln" style="color: #303336;"> <br/>    </span><span class="tag" style="color: #7d2727;"><c:set</span><span class="pln" style="color: #303336;"> </span><span class="atn" style="color: #e64320;">var</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;">"value"</span><span class="pln" style="color: #303336;"> </span><span class="atn" style="color: #e64320;">value</span><span class="pun" style="color: #303336;">=</span><span class="atv" style="color: #0f74bd;">"#{cc.attrs.model.value}"</span><span class="pln" style="color: #303336;"> </span><span class="tag" style="color: #7d2727;">/></span><span class="pln" style="color: #303336;"> <br/>    #{of:format1('Hello {0}', value)} </span><span class="com" style="color: #858c93;"><!-- Prints "Hello World" correctly --></span><span class="pln" style="color: #303336;"> <br/>    #{of:format1('Hello {0}', cc.attrs.model.value)} </span><span class="com" style="color: #858c93;"><!-- THROWS javax.el.ELException --></span><span class="pln" style="color: #303336;"> <br/>   </span><span class="tag" style="color: #7d2727;"></div></span><span class="pln" style="color: #303336;"> <br/>  </span><span class="tag" style="color: #7d2727;"></cc:implementation></span><span class="pln" style="color: #303336;"> <br/></span><span class="tag" style="color: #7d2727;"> </h:body></span><span class="pln" style="color: #303336;">  <br/></span><span class="tag" style="color: #7d2727;"></html></span>

The second version with the inlined cc.attrs.model.value works in JBoss 7.1 (which uses a patched version of Mojarra 1.2.15) but fails on Wildfly 10.1. Wildfly originally ships with a patched version of Mojarra 2.2.13, but the EL fails to evaluate even after upgrading to 2.2.14.

User BalusC on SO has hinted, that this might be a Mojarra bug handling XML namespaces. I debugged into the ExpressionBuilder and can also confirm that the builder has lost all references to namespaces declared within the custom component after evaluating cc.attrs.model.value

This is rather annoying, because it currently blocks our migration.

This discussion has been closed.