Details
-
Type: Bug
-
Status: Closed
-
Priority: Major
-
Resolution: Fixed
-
Affects Version/s: EE-3.2.0.BETA
-
Fix Version/s: EE-3.2.0.GA
-
Component/s: Framework
-
Labels:None
-
Environment:MyFaces
-
Assignee Priority:P1
Description
When trying to run the showcase application with MyFaces instead of Mojarra, I ran into a problem where numerous JavaScript exceptions were thrown by the client. It seems to be related to ResourceOrdering.
It looks like all the requisite files are being loaded so I thought it might be a question of the order. When I put some debugging in the ResourceOrdering class I saw that the ordered resources were being processed the same way:
MyFaces
ResourceOrdering.orderResources: head facet is called head
ResourceOrdering.orderResources: resource container org.apache.myfaces.component.ComponentResourceContainer@22c9af86
ResourceOrdering.orderResources: added themes/sam/theme.css as a defined resource
ResourceOrdering.orderResources: added jsf.js as a defined resource
ResourceOrdering.orderResources: added util/ace-yui.js as a defined resource
ResourceOrdering.orderResources: added util/combined.css as a defined resource
ResourceOrdering.orderResources: added util/ace-jquery.js as a defined resource
etc...
Mojarra
ResourceOrdering.orderResources: head facet is called javax_faces_location_HEAD
ResourceOrdering.orderResources: resource container com.sun.faces.component.ComponentResourceContainer@5bbe1466
ResourceOrdering.orderResources: added themes/sam/theme.css as a defined resource
ResourceOrdering.orderResources: added jsf.js as a defined resource
ResourceOrdering.orderResources: added util/ace-yui.js as a defined resource
ResourceOrdering.orderResources: added util/combined.css as a defined resource
ResourceOrdering.orderResources: added util/ace-jquery.js as a defined resource
etc…
But when I looked at the final rendered output, the Mojarra markup matches the order we added the resources but the MyFaces code does not - it's in some other unpredictable order. So it seems that the ResourceOrdering strategy is not working the same way with MyFaces. - that is, the underlying collection/list/set/map is not honouring the order that we're adding the resources back in (or something to that effect).
It looks like all the requisite files are being loaded so I thought it might be a question of the order. When I put some debugging in the ResourceOrdering class I saw that the ordered resources were being processed the same way:
MyFaces
ResourceOrdering.orderResources: head facet is called head
ResourceOrdering.orderResources: resource container org.apache.myfaces.component.ComponentResourceContainer@22c9af86
ResourceOrdering.orderResources: added themes/sam/theme.css as a defined resource
ResourceOrdering.orderResources: added jsf.js as a defined resource
ResourceOrdering.orderResources: added util/ace-yui.js as a defined resource
ResourceOrdering.orderResources: added util/combined.css as a defined resource
ResourceOrdering.orderResources: added util/ace-jquery.js as a defined resource
etc...
Mojarra
ResourceOrdering.orderResources: head facet is called javax_faces_location_HEAD
ResourceOrdering.orderResources: resource container com.sun.faces.component.ComponentResourceContainer@5bbe1466
ResourceOrdering.orderResources: added themes/sam/theme.css as a defined resource
ResourceOrdering.orderResources: added jsf.js as a defined resource
ResourceOrdering.orderResources: added util/ace-yui.js as a defined resource
ResourceOrdering.orderResources: added util/combined.css as a defined resource
ResourceOrdering.orderResources: added util/ace-jquery.js as a defined resource
etc…
But when I looked at the final rendered output, the Mojarra markup matches the order we added the resources but the MyFaces code does not - it's in some other unpredictable order. So it seems that the ResourceOrdering strategy is not working the same way with MyFaces. - that is, the underlying collection/list/set/map is not honouring the order that we're adding the resources back in (or something to that effect).
To help verify that ResourceOrdering is the issue, I tweaked the code so that, when running MyFaces, we skip any processing of jsf.js and this appeared to allow the script resources to load and evaluate more normally.
if( EnvUtils.isMyFaces() && name != null && name.startsWith("jsf."))
{ //MyFaces doesn't seem to like it if we add and remove the jsf. }else{
{ root.removeComponentResource(context, next, target); orderedChildren.add(next); }if (resourceEntry.name.equals(name) && resourceEntry.library.equals(library))
}
However, since this isn't likely to be a "real" fix, I'll turn this over to Mircea to have a look.