mojarra
mojarra copied to clipboard
StackoverflowError with nested custom JSF tags
The stackoverflow happens on "random" places, currently only when EL code is being parsed. Simple code like:
WEB-INF/resources/tags/foo/some_foo_tag.tpl:
<?xml version="1.0" encoding="UTF-8" ?>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:panelGroup layout="block" rendered="#{empty rendered or rendered}">
<h:outputText value="#{messageBundle.SOME_FOO_TEXT}" />
<!-- Do some more JSF tags here. //-->
</h:panelGroup>`
</ui:composition>
... or just showing a message from a i18n bundle within that tag will also trigger it.
Have another similar tag, but reference the foo tag in it:
<?xml version="1.0" encoding="UTF-8" ?>
<ui:composition
xmlns="http://www.w3.org/1999/xhtml"
xmlns:widgets="http://example.org/jsf/widgets"
xmlns:f="http://xmlns.jcp.org/jsf/core"
xmlns:h="http://xmlns.jcp.org/jsf/html"
xmlns:ui="http://xmlns.jcp.org/jsf/facelets">
<h:panelGroup layout="block" rendered="#{empty rendered or rendered}">
<h:outputText value="#{messageBundle.SOME_BAR_TEXT}" />
<widgets:someFooText rendered="#{rendered}" />
</h:panelGroup>`
</ui:composition>
The bug can be reproduced with a simple setup
- Payara 4.1 (build 173)
- Mojarra 2.3.2 ( 20170627-2139 e63598abf2ed2bb1a24674f308a734e0dce18a72)
Steps to reproduce:
- have a custom JSF tag enclosed with
<ui:composition>where some JSF tags are included - have it properly registered in a file like
widgets.jsf.taglib.xml:
<?xml version="1.0" encoding="UTF-8"?>
<facelet-taglib version="2.2"
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd">
<namespace>http://example.org/jsf/widgets</namespace>
<tag>
<tag-name>someFooTag</tag-name>
<description>This tag renders foo tags.</description>
<source>resources/tags/foo_tag.tpl</source>
<attribute>
<name>rendered</name>
<description>Whether this tag is being rendered by JSF engine.</description>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
</tag>
<tag>
<tag-name>someBarTag</tag-name>
<description>This tag renders bar tags.</description>
<source>resources/tags/bar_tag.tpl</source>
<attribute>
<name>rendered</name>
<description>Whether this tag is being rendered by JSF engine.</description>
<required>false</required>
<type>java.lang.Boolean</type>
</attribute>
</tag>
</facelet-taglib>
- have that file properly registered with
web.xml:
<context-param>
<description>Generic custom JSF tags library</description>
<param-name>javax.faces.FACELETS_LIBRARIES</param-name>
<param-value>/WEB-INF/widgets.jsf.taglib.xml</param-value>
</context-param>
The whole exception can be downloaded from here: https://cloud.mxchange.org/index.php/s/149vSQYmDeENiuY/download?path=%2FMojarra&files=stackoverflow-error.txt
If you cannot reproduce it like this, I can setup a WAR project using the said tags.
It wasn't clear how to reference the tags. I ended up with <h:body><widget:anotherSimilarTag/></h:body>, but it works just fine for me with Mojarra 2.3.2 on Tomcat 8.5.20. I'll try Payara later when time allows me.
Hi @BalusC , your answers on stackoverflow are treasure chests! 👍 Yes, same "problem" here, low time, to much to do.
Can't reproduce on Payara 4.1.2.173 with Mojarra 2.3.2 either. Perhaps some essential trigger is missing in the information provided so far. A reproducer WAR would be helpful.
Will setup a small project for it.
Please see this important message regarding community contributions to Mojarra.
https://javaee.groups.io/g/jsf-spec/message/30
Also, please consider joining that group, as that group has taken the place of the old [email protected] mailing list.
Thanks,
Ed Burns
Was fallen off the radar, need to notify myself so I can bookmark it and work on it.