You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@myfaces.apache.org by "Val Blant (JIRA)" <de...@myfaces.apache.org> on 2008/01/30 19:37:35 UTC

[jira] Created: (MYFACES-1812) All faces-config.xml get loaded twice from jars in WEB-INF/lib

All faces-config.xml get loaded twice from jars in WEB-INF/lib
--------------------------------------------------------------

                 Key: MYFACES-1812
                 URL: https://issues.apache.org/jira/browse/MYFACES-1812
             Project: MyFaces Core
          Issue Type: Bug
            Reporter: Val Blant


"ClassUtils.getResources(FACES_CONFIG_RESOURCE, this)" will return an iterator over all "META-INF/faces-config.xml" resources that were found. The search is carried out by starting at WebAppClassLoader and making an Enumeration of all resources with the given name that WebAppClassLoader and all its parents see. The jars placed into WEB-INF/lib will be seen by the WebAppClassLoader AND AppClassLoader, thus resulting in the same jars (the ones that have "META-INF/faces-config.xml") being placed on the list twice. 

This is fine, but things break when FacesConfigurator.feedClassloaderConfigurations() does not check for duplicate URLs and just blindly registers everything from these jars twice. 

One of the effects of this bug is that all phase listeners get registered and therefore executed twice.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-1812) All faces-config.xml get loaded twice from jars in WEB-INF/lib

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564217#action_12564217 ] 

Martin Marinschek commented on MYFACES-1812:
--------------------------------------------

I need to add: I'm not sure about this - and haven't tested the behaviour. I have never seen this happening in any of my web-applications - and I wonder what the difference in environment you have. The reason why I rewrote the code still is that we also need to sort the faces-config.xml-files by name of the jar they are contained in - we didn't do this so far, but it is in the spec, so I could kill this ommission with the same commit.

regards,

Martin

> All faces-config.xml get loaded twice from jars in WEB-INF/lib
> --------------------------------------------------------------
>
>                 Key: MYFACES-1812
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1812
>             Project: MyFaces Core
>          Issue Type: Bug
>            Reporter: Val Blant
>
> "ClassUtils.getResources(FACES_CONFIG_RESOURCE, this)" will return an iterator over all "META-INF/faces-config.xml" resources that were found. The search is carried out by starting at WebAppClassLoader and making an Enumeration of all resources with the given name that WebAppClassLoader and all its parents see. The jars placed into WEB-INF/lib will be seen by the WebAppClassLoader AND AppClassLoader, thus resulting in the same jars (the ones that have "META-INF/faces-config.xml") being placed on the list twice. 
> This is fine, but things break when FacesConfigurator.feedClassloaderConfigurations() does not check for duplicate URLs and just blindly registers everything from these jars twice. 
> One of the effects of this bug is that all phase listeners get registered and therefore executed twice.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Commented: (MYFACES-1812) All faces-config.xml get loaded twice from jars in WEB-INF/lib

Posted by "Val Blant (JIRA)" <de...@myfaces.apache.org>.
    [ https://issues.apache.org/jira/browse/MYFACES-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12564867#action_12564867 ] 

Val Blant commented on MYFACES-1812:
------------------------------------

Tested 1.2.3-SNAPSHOT - works as expected now. Thanks, Martin.

I think the reason most people don't see this happen might be b/c people usually have a WAR and an EAR class loader. I am not 100% sure, but I think that the EAR class loader would not see the stuff under WEB-INF/lib. In my development environment I start my web app in place with Jetty6 with help of an Eclipse plugin. This results in a WAR class loader and a Launcher class loader, which sees all of the web project's dependencies, including the jars under WEB-INF/lib.


Val

> All faces-config.xml get loaded twice from jars in WEB-INF/lib
> --------------------------------------------------------------
>
>                 Key: MYFACES-1812
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1812
>             Project: MyFaces Core
>          Issue Type: Bug
>            Reporter: Val Blant
>            Assignee: Martin Marinschek
>             Fix For: 1.2.3-SNAPSHOT
>
>
> "ClassUtils.getResources(FACES_CONFIG_RESOURCE, this)" will return an iterator over all "META-INF/faces-config.xml" resources that were found. The search is carried out by starting at WebAppClassLoader and making an Enumeration of all resources with the given name that WebAppClassLoader and all its parents see. The jars placed into WEB-INF/lib will be seen by the WebAppClassLoader AND AppClassLoader, thus resulting in the same jars (the ones that have "META-INF/faces-config.xml") being placed on the list twice. 
> This is fine, but things break when FacesConfigurator.feedClassloaderConfigurations() does not check for duplicate URLs and just blindly registers everything from these jars twice. 
> One of the effects of this bug is that all phase listeners get registered and therefore executed twice.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


[jira] Resolved: (MYFACES-1812) All faces-config.xml get loaded twice from jars in WEB-INF/lib

Posted by "Martin Marinschek (JIRA)" <de...@myfaces.apache.org>.
     [ https://issues.apache.org/jira/browse/MYFACES-1812?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Martin Marinschek resolved MYFACES-1812.
----------------------------------------

       Resolution: Fixed
    Fix Version/s: 1.2.3-SNAPSHOT

P.S.: can you please test the new snapshot tomorrow and tell us the results?

regards,

Martin

> All faces-config.xml get loaded twice from jars in WEB-INF/lib
> --------------------------------------------------------------
>
>                 Key: MYFACES-1812
>                 URL: https://issues.apache.org/jira/browse/MYFACES-1812
>             Project: MyFaces Core
>          Issue Type: Bug
>            Reporter: Val Blant
>            Assignee: Martin Marinschek
>             Fix For: 1.2.3-SNAPSHOT
>
>
> "ClassUtils.getResources(FACES_CONFIG_RESOURCE, this)" will return an iterator over all "META-INF/faces-config.xml" resources that were found. The search is carried out by starting at WebAppClassLoader and making an Enumeration of all resources with the given name that WebAppClassLoader and all its parents see. The jars placed into WEB-INF/lib will be seen by the WebAppClassLoader AND AppClassLoader, thus resulting in the same jars (the ones that have "META-INF/faces-config.xml") being placed on the list twice. 
> This is fine, but things break when FacesConfigurator.feedClassloaderConfigurations() does not check for duplicate URLs and just blindly registers everything from these jars twice. 
> One of the effects of this bug is that all phase listeners get registered and therefore executed twice.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.