Hi

You need to take a look at:

org.apache.myfaces.spi.FacesConfigResourceProvider
org.apache.myfaces.spi.FaceletConfigResourceProvider
org.apache.myfaces.spi.AnnotationProvider

http://myfaces.apache.org/core21/myfaces-impl/apidocs/org/apache/myfaces/spi/FacesConfigResourceProvider.html
http://myfaces.apache.org/core21/myfaces-impl/apidocs/org/apache/myfaces/spi/FaceletConfigResourceProvider.html

I think the problem is this code:

    public Collection<URL> getMetaInfConfigurationResources(
            ExternalContext context) throws IOException
    {
        List<URL> urlSet = new ArrayList<URL>();

        //This usually happens when maven-jetty-plugin is used
        //Scan jars looking for paths including META-INF/faces-config.xml
        Enumeration<URL> resources =
getClassLoader().getResources(FACES_CONFIG_IMPLICIT);
        while (resources.hasMoreElements())
        {
            urlSet.add(resources.nextElement());
        }

        //Scan files inside META-INF ending with .faces-config.xml
        URL[] urls = Classpath.search(getClassLoader(),
META_INF_PREFIX, FACES_CONFIG_SUFFIX);
        for (int i = 0; i < urls.length; i++)
        {
            urlSet.add(urls[i]);
        }

        return urlSet;
    }

Specially the call to Classpath.search(). The code works well, but
maybe in GAE this operation is very expensive. One option is do not
scan for .faces-config.xml, or try to scan the jar files directly from
WEB-INF/lib. Note the call from Classpath.search() is done in the
annotation scanning part too, so if you found it is a problem, maybe
we can do the alternative logic and include it inside myfaces core to
make it work "out of the box" in gae without this problem. Look this
demo:

http://myfaces.apache.org/core20/googleappenginesupport.html

regards,

Leonardo Uribe

2012/5/23 lucio piccoli <[email protected]>:
> hi leonardo
>
> thanks for the help but there was no difference in startup time.
>
> from the log the big time expense is scanning for faces-config.xml.
>
>  org.apache.myfaces.config.DefaultFacesConfigurationProvider
> getClassloaderFacesConfig
>
>
> what other options are there to prevent file scanning?
>
>
> -lp
>
>
> On 22 May 2012 17:26, Leonardo Uribe <[email protected]> wrote:
>
>> Hi
>>
>> MyFaces provides some SPI interfaces that allow to provide web
>> container specific code in cases like annotation scannig or when it
>> tries to locate faces-config.xml or .taglib.xml files.
>>
>> But first of all, try to setup this web config param:
>>
>> org.apache.myfaces.annotation.SCAN_PACKAGES
>>
>> Indicate the packages where your managed beans are, separated by
>> comma. Let us know if that solves your problem, or if you do some SPI
>> code, it could be good to add it in myfaces core project in someway.
>>
>> regards,
>>
>> Leonardo Uribe
>>
>> 2012/5/22 lucio piccoli <[email protected]>:
>> > the spring issue is exclusive to the myfaces startup.
>> >
>> > the myfaces startup seems to be spending its time doing a file scan for
>> > 'faces-config.xml' and other stuff.
>> > File access speed is known to be poor on GAE.
>> >
>> > so is there a way to config myfaces not to file scan?
>> >
>> > -lp
>> >
>> > On 22 May 2012 17:07, Daniel Reznick <[email protected]> wrote:
>> >
>> >> Before that,
>> >>
>> >> Know that Spring and JSF are known for their SLOW start up time on GAE
>> (I
>> >> think especially Sping) a short googling can show this , and maybe some
>> >> tricks to speed it up (but it still will be slow...)
>> >>
>> >> On Tue, May 22, 2012 at 5:13 AM, lucio piccoli <[email protected]>
>> >> wrote:
>> >>
>> >> > hi guys
>> >> >
>> >> > i am running myfaces 2.1.6 on appengine 1.6.4.
>> >> >
>> >> > the start up time is too long. according to my log 13 seconds of wall
>> >> time.
>> >> >
>> >> > this 13 sec is killing my GAE startup time as it has a hardlimit.
>> >> >
>> >> > Q1. why is myfaces taking 12 seconds to load?
>> >> > Q2. how can i reduce the myfaces load time?
>> >> >
>> >> > the log snippet is below. the start of the log is once spring
>> initiation
>> >> is
>> >> > complete.
>> >> >
>> >> > INFO: Root WebApplicationContext: initialization completed in 9598 ms
>> >> > 22/05/2012 1::57:04 AM org.apache.myfaces.webapp.Jsp20FacesInitializer
>> >> > initContainerIntegration
>> >> > INFO: This application isn't running in a JSP 2.1 container.
>> >> > 22/05/2012 1:57:04 AM
>> >> > org.apache.myfaces.config.DefaultFacesConfigurationProvider
>> >> > getStandardFacesConfig
>> >> > INFO: Reading standard config META-INF/standard-faces-config.xml
>> >> > 22/05/2012 1:57:05 AM
>> >> > org.apache.myfaces.config.DefaultFacesConfigurationProvider
>> >> > getWebAppFacesConfig
>> >> > INFO: Reading config /WEB-INF/faces-config.xml
>> >> > 22/05/2012 1:57:08 AM
>> >> > org.apache.myfaces.config.DefaultFacesConfigurationProvider
>> >> > getClassloaderFacesConfig
>> >> > INFO: Reading config :
>> >> >
>> >> >
>> >>
>> jar:file:/C:/src/miiingle/venueportal/trunk/target/venueportal-1.0-SNAPSHOT/WEB-INF/lib/gmaps4jsf-core-1.1.4.jar!/META-INF/faces-config.xml
>> >> > 22/05/2012 1:57:09 AM
>> >> > org.apache.myfaces.config.DefaultFacesConfigurationProvider
>> >> > getClassloaderFacesConfig
>> >> > INFO: Reading config :
>> >> >
>> >> >
>> >>
>> jar:file:/C:/src/miiingle/venueportal/trunk/target/venueportal-1.0-SNAPSHOT/WEB-INF/lib/richfaces-components-ui-4.2.1.Final.jar!/META-INF/faces-config.xml
>> >> > 22/05/2012 1:57:12 AM
>> >> > org.apache.myfaces.config.DefaultFacesConfigurationProvider
>> >> > getClassloaderFacesConfig
>> >> > INFO: Reading config :
>> >> >
>> >> >
>> >>
>> jar:file:/C:/src/miiingle/venueportal/trunk/target/venueportal-1.0-SNAPSHOT/WEB-INF/lib/richfaces-core-impl-4.2.1.Final.jar!/META-INF/faces-config.xml
>> >> > 22/05/2012 1:57:12 AM
>> >> > org.apache.myfaces.config.DefaultFacesConfigurationProvider
>> >> > getClassloaderFacesConfig
>> >> > INFO: Reading config :
>> >> >
>> >> >
>> >>
>> jar:file:/C:/src/miiingle/venueportal/trunk/target/venueportal-1.0-SNAPSHOT/WEB-INF/lib/tomahawk20-1.1.11.jar!/META-INF/faces-config.xml
>> >> > 22/05/2012 1:57:12 AM org.apache.myfaces.config.LogMetaInfUtils
>> >> logArtifact
>> >> > INFO: Artifact 'myfaces-api' was found in version '2.1.6' from path
>> >> >
>> >> >
>> >>
>> 'file:/C:/src/miiingle/venueportal/trunk/target/venueportal-1.0-SNAPSHOT/WEB-INF/lib/myfaces-api-2.1.6.jar'
>> >> > 22/05/2012 1:57:12 AM org.apache.myfaces.config.LogMetaInfUtils
>> >> logArtifact
>> >> > INFO: Artifact 'myfaces-impl' was found in version '2.1.6' from path
>> >> >
>> >> >
>> >>
>> 'file:/C:/src/miiingle/venueportal/trunk/target/venueportal-1.0-SNAPSHOT/WEB-INF/lib/myfaces-impl-2.1.6.jar'
>> >> > 22/05/2012 1:57:12 AM org.apache.myfaces.config.LogMetaInfUtils
>> >> logArtifact
>> >> > INFO: Artifact 'tomahawk20' was found in version '1.1.11' from path
>> >> >
>> >> >
>> >>
>> 'file:/C:/src/miiingle/venueportal/trunk/target/venueportal-1.0-SNAPSHOT/WEB-INF/lib/tomahawk20-1.1.11.jar'
>> >> > 22/05/2012 1:57:13 AM org.richfaces.resource.ResourceHandlerImpl
>> <init>
>> >> > FINE: Instance of org.richfaces.resource.ResourceHandlerImpl resource
>> >> > handler created
>> >> > 22/05/2012 1:57:13 AM org.apache.myfaces.util.ExternalSpecifications
>> >> > isBeanValidationAvailable
>> >> > INFO: MyFaces Bean Validation support disabled
>> >> > 22/05/2012 1:57:15 AM net.sf.jsfcomp.onload.OnLoadPhaseListener <init>
>> >> > INFO: OnLoadPhaseListener created
>> >> > 22/05/2012 1:57:15 AM org.apache.myfaces.application.ApplicationImpl
>> >> > getProjectStage
>> >> > INFO: Couldn't discover the current project stage, using Production
>> >> > 22/05/2012 1:57:15 AM org.apache.myfaces.config.FacesConfigurator
>> >> > handleSerialFactory
>> >> > INFO: Serialization provider : class
>> >> > org.apache.myfaces.shared_impl.util.serial.DefaultSerialFactory
>> >> > 22/05/2012 1:57:15 AM
>> >> > org.apache.myfaces.config.annotation.DefaultLifecycleProviderFactory
>> >> > getLifecycleProvider
>> >> > INFO: Using LifecycleProvider
>> >> >
>> >>
>> org.apache.myfaces.config.annotation.NoInjectionAnnotationLifecycleProvider
>> >> >
>> >> > --
>> >> > regards
>> >> >
>> >> > -Lucio Piccoli
>> >> >
>> >> > Director
>> >> > ------------------------------
>> >> > www.asteriski.com
>> >> >
>> >>
>> >
>> >
>> >
>> > --
>> > regards
>> >
>> > -Lucio Piccoli
>> >
>> > Director
>> > ------------------------------
>> > www.asteriski.com
>>
>
>
>
> --
> regards
>
> -Lucio Piccoli
>
> Director
> ------------------------------
> www.asteriski.com

Reply via email to