Hi Matthias,

It happens on Windows as well.
After some investigation I found out that the trouble maker is method
org.apache.myfaces.trinidadinternal.config.GlobalConfiguratorImpl#init(javax.faces.context.ExternalContext),
and the critical section is

  if (!_initialized)
    {
      try
      {
        _services =
ClassLoaderUtils.getServices(Configurator.class.getName());

        // Create a new RequestContextFactory is needed
        if (RequestContextFactory.getFactory() == null)
        {
          RequestContextFactory.setFactory(new RequestContextFactoryImpl());
        }

        // Create a new SkinFactory if needed.
        if (SkinFactory.getFactory() == null)
        {
          SkinFactory.setFactory(new SkinFactoryImpl());
        }

which  , when two request are being sent simultaneously straight after ther
server has just started,  (occasionally) throws the  IllegalStateException,
"FACTORY_ALREADY_AVAILABLE_FOR_CLASS_LOADER" . Either in
RequestContextFactory.setFactory or SkinFactory.setFactory.

I don't have the overall picture of the whole Trinidad architecture, but
just from what I see in the method's code , it seems to me that the
initialization of the factories should be in a synchronized block, using
webapp classloader as a lock.

Jakub




On 31 August 2010 12:38, Matthias Wessendorf <[email protected]> wrote:

> Tried with TRINIDAD-1.2.15-SNAPSHOT (our 12x "trunk") + MyFaces 1.2.9
>
> could not reproduce it with the Trinidad demo
>
> On Tue, Aug 31, 2010 at 12:12 PM, Matthias Wessendorf <[email protected]>
> wrote:
> > Jakub,
> >
> > this does NOT happen on windows, right ?
> >
> > -Matthias
> >
> > On Tue, Aug 24, 2010 at 4:11 PM, Jakub Kahovec
> > <[email protected]> wrote:
> >> Hi Matthias,
> >>
> >> thanks for your reply.
> >> Well, brief steps how to reproduce this are already in the ticket (not
> much
> >> descriptive though :-). The scenario consist just from
> >> creating two JSF pages and sending them simultaneously immediately when
> the
> >> server has just started.
> >> As regards the patch, I've just spoken to Rich Kao who is there as an
> author
> >> of the comment and he said he's there by mistake actually, he said he'd
> just
> >> voted for this issue which happened to appear at patch available
> comment.
> >> I'm wondering why no one else is complaining as it seems this issue it
> must
> >> occur quite often.
> >>
> >> Jakub
> >>
> >> On 24 August 2010 14:56, Matthias Wessendorf <[email protected]> wrote:
> >>
> >>> HEllo Jakub,
> >>>
> >>> can you update the ticket with how to reproduce?
> >>> I'll take a look next week (currently on vacation)
> >>>
> >>> -M
> >>>
> >>> On Tue, Aug 24, 2010 at 2:48 PM, Jakub Kahovec
> >>> <[email protected]> wrote:
> >>> > Hi there,
> >>> >
> >>> > in our application (tomcat 6.0.28+ trinidad 1.2.13+facelets) we are
> time
> >>> to
> >>> > time experiencing java.lang.IllegalStateException: Factory already
> >>> available
> >>> > for this class loader, which
> >>> > seems to be happening when there are two (or more) requests sent very
> >>> > quickly to the server (which IMHO should be pretty normal in busy web
> >>> apps,
> >>> > right ?)
> >>> > I've found this problem reported in apache JIRA (
> >>> >
> >>>
> https://issues.apache.org/jira/browse/TRINIDAD-195?page=com.atlassian.jira.plugin.system.issuetabpanels%3Aall-tabpanel
> >>> )
> >>> > but there is no solution (it shows that there is a patch is available
> but
> >>> > it's not there) and the priority was changed from major or minor.
> >>> > Well, this issue seems to me quite critical unless there is something
> >>> wrong
> >>> > in our settings, which might be likely as I haven't found much
> references
> >>> to
> >>> > this issue (actually just one).
> >>> > So has anyone else experienced this problem or is there an easy fix
> or
> >>> > workaround for it ?
> >>> >
> >>> > Thanks.
> >>> >
> >>> > Jakub
> >>> >
> >>>
> >>>
> >>>
> >>> --
> >>> Matthias Wessendorf
> >>>
> >>> blog: http://matthiaswessendorf.wordpress.com/
> >>> sessions: http://www.slideshare.net/mwessendorf
> >>> twitter: http://twitter.com/mwessendorf
> >>>
> >>
> >
> >
> >
> > --
> > Matthias Wessendorf
> >
> > blog: http://matthiaswessendorf.wordpress.com/
> > sessions: http://www.slideshare.net/mwessendorf
> > twitter: http://twitter.com/mwessendorf
> >
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>

Reply via email to