You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Andreas Schenk <dr...@gmx.net> on 2005/09/27 15:18:04 UTC

META-INF/faces-config.xml not loaded

Hi,

if my understanding of the spec is correct, then myfaces should load the file 
META-INF/faces-config.xml at application startup. See Chapter 10.3.2. 
Unfortunately is does not. Quote of 10.3.2:

Begin quote:

At application startup time, before any requests are processed, the JSF 
implementation must process zero or more application configuration resources, 
located according to the following algorithm:

* Search for all resources named "META-INF/faces-config.xml" in the 
ServletContext resource path for this web application, and load each as a JSF 
configuration resource (...)

...

End quote.

In my (very) simple example the call to 
getResources("META-INF/faces-config.xml") yields the following two files

file:/tmp/as/java/ObjectWeb/JOnAS/jonas_test_base_443/work/webapps/jonas/GASWEB/META-INF/faces-config.xml
jar:file:/tmp/as/java/ObjectWeb/JOnAS/jonas_test_base_443/work/webapps/jonas/GASWEB/WEB-INF/lib/tomahawk.jar!/META-INF/faces-config.xml

The first one is not loaded.

I am using the nightly build 20050812. Is this a bug, or do I misunderstand 
something here?

Regards,

Andreas Schenk

Re: META-INF/faces-config.xml not loaded

Posted by Martin Marinschek <ma...@gmail.com>.
Yes,

there has been a change in this a few weeks ago!

So this was a version problem...

Get yourself the latest nightly and work with this!

regards,

Martin

On 9/27/05, Andreas Schenk <dr...@gmx.net> wrote:
> Am Dienstag, 27. September 2005 15:25 schrieb Martin Marinschek:
> > Hmm...
> >
> > if you look at the following code in
> >
> > public class FacesConfigurator
> >
> > private static final String FACES_CONFIG_RESOURCE =
> > "META-INF/faces-config.xml";
> >
> > you see that we do try to parse this.
> >
> > Strange that it shouldn't work - we call getResources() just like you do?
>
> Well, in fact you don't -- at least not in the nightly build 20050812, where I
> cannot find any call to getResources() at all. So it must have been changed
> in the meantime.
>
> Thanks for your answer.
>
> Regards,
>
> Andreas Schenk
>


--

http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German

Re: META-INF/faces-config.xml not loaded

Posted by Andreas Schenk <dr...@gmx.net>.
Am Dienstag, 27. September 2005 15:25 schrieb Martin Marinschek:
> Hmm...
>
> if you look at the following code in
>
> public class FacesConfigurator
>
>     private static final String FACES_CONFIG_RESOURCE =
> "META-INF/faces-config.xml";
>
> you see that we do try to parse this.
>
> Strange that it shouldn't work - we call getResources() just like you do?

Well, in fact you don't -- at least not in the nightly build 20050812, where I 
cannot find any call to getResources() at all. So it must have been changed 
in the meantime. 

Thanks for your answer.

Regards,

Andreas Schenk

Re: META-INF/faces-config.xml not loaded

Posted by Martin Marinschek <ma...@gmail.com>.
Hmm...

if you look at the following code in

public class FacesConfigurator

    private static final String FACES_CONFIG_RESOURCE =
"META-INF/faces-config.xml";

you see that we do try to parse this.

Strange that it shouldn't work - we call getResources() just like you do?

regards,

Martin

    /**
     * This method fixes MYFACES-208
     */
    private void feedClassloaderConfigurations()
    {
        try
        {
            Iterator it = ClassUtils.getResources(FACES_CONFIG_RESOURCE, this);
            while (it.hasNext())
            {
                URL url = (URL)it.next();
                InputStream stream = url.openStream();
                String systemId = url.toExternalForm();
                if (log.isInfoEnabled()) log.info("Reading config " + systemId);
                _dispenser.feed(_unmarshaller.getFacesConfig(stream, systemId));
                stream.close();
            }
        }
        catch (Exception e)
        {
            throw new FacesException(e);
        }
    }

On 9/27/05, Andreas Schenk <dr...@gmx.net> wrote:
> Hi,
>
> if my understanding of the spec is correct, then myfaces should load the file
> META-INF/faces-config.xml at application startup. See Chapter 10.3.2.
> Unfortunately is does not. Quote of 10.3.2:
>
> Begin quote:
>
> At application startup time, before any requests are processed, the JSF
> implementation must process zero or more application configuration resources,
> located according to the following algorithm:
>
> * Search for all resources named "META-INF/faces-config.xml" in the
> ServletContext resource path for this web application, and load each as a JSF
> configuration resource (...)
>
> ...
>
> End quote.
>
> In my (very) simple example the call to
> getResources("META-INF/faces-config.xml") yields the following two files
>
> file:/tmp/as/java/ObjectWeb/JOnAS/jonas_test_base_443/work/webapps/jonas/GASWEB/META-INF/faces-config.xml
> jar:file:/tmp/as/java/ObjectWeb/JOnAS/jonas_test_base_443/work/webapps/jonas/GASWEB/WEB-INF/lib/tomahawk.jar!/META-INF/faces-config.xml
>
> The first one is not loaded.
>
> I am using the nightly build 20050812. Is this a bug, or do I misunderstand
> something here?
>
> Regards,
>
> Andreas Schenk
>


--

http://www.irian.at
Your JSF powerhouse -
JSF Trainings in English and German