This week we set up a developoment environment on a new PC for a JavaEE project using Tomcat 8.5 (we downloaded the recently released version 8.5.49 to be specific).
We started up the IDE, deployed the WAR on a Tomcat server and ran into the following error:
javax.faces.view.facelets.TagAttributeException: [...] Could not Resolve Variable [Overflow]: ...
After some research using our favorite search engine we came across:
https://stackoverflow.com/questions/35372187/jsf-uiinclude-recursion-causes-java-lang-stackoverflowerror and
http://balusc.omnifaces.org/2016/02/recursive-tree-of-composite-components.html
So… sounds like there is a recursive file include?
Strangely some weeks ago the project ran on our old developoment environment that had a Tomcat 8.5.14…
Also these posts were relatively old… Well, we started to try to resolve the error.
As a test we removed the includes and the error disappeared. When we added one of the includes it showed up again.
Next I changed the relative paths like (<ui:include src="../test.xhtml" />
) to absolute paths like (<ui:include src="/app/testfolder/test.xhtml" />
) and the error disappeared again.
Weird… so relative paths don’t work in the latest Tomcat version? Such a major change in a minor version update?
We searched for patch notes but could not find any that were related to our problem.
In a small test project I set up I could reproduce the error, so it was not related to a configuration.
As a next step I tried to start the testproject in an older Tomcat version (8.5.47) and could not reproduce the stackoverflow.
I also tried it with the latest Tomcat release (9.0.29) which resulted in the same error and the previous version (9.0.27) which also turned out to be fine.
Is this a Bug and not a feature? Searching the Tomcat Bugzilla resulted in https://bz.apache.org/bugzilla/show_bug.cgi?id=63969
A bug in the Tomcat versions 8.5.49 and 9.0.29.
So if you come across a Stackoverflow in VariableMapperWrapper like
1 2 3 |
javax.el.ELException: Could not Resolve Variable [Overflow]: com.sun.faces.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:90) com.sun.faces.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:86) |
or
1 |
at com.sun.faces.facelets.el.VariableMapperWrapper.resolveVariable(VariableMapperWrapper.java:104) |
And you are using Tomcat 8.5.49 or 9.0.29 You have the following options:
- Change all relative include paths to absolute paths starting with
'/'
- Switch to an older / newer Tomcat version (The bug is already resolved in 8.5.50-dev and 9.0.30-dev, I don’t think they will wait very long with the release of these two)
I Hope this helped you not waste as much time on this problem as me…
Thank you for reading!
Thank you very much, Michael, that saved my weekend. It appears our new customer-environment had just this Tomcat-Version and the very same problem. The effort and detail you put into the resolution is just awesome!
Hi Markis
You saved my day! Upgrade to tomcat 9.0.30 fixed it
Thank you!
Thank You so much.. You saved millions of hours.. Salute !!!!
Thanks a lot for sharing.
The stack overflow was happening here too. Funny enough, I found it the same way you did I started taking out all the and voila, no more stack overflow. Now I know how can I fix it!
Thank you Michael!