Hi-
This is still an issue for our team. The problem occurs when a new class file is deployed, not a JSP. For example, if I have a managed bean that I update and then copy to the deployment directory, I get the "java.lang.IllegalStateException: No Factories configured for this Application..." error.
The root of the problem is in the implementation of FactoryFinder. It stores the Factory classes in a Map where the key to the Map is the current ClassLoader. For Weblogic when you deploy a new class, it drops the current Servlet's classloader and creates a new one. That means the call to get a Factory returns null because the new classloader is not a valid key.
FactoryFinder snippet:
ClassLoader classLoader = getClassLoader();
Map factoryClassNames = (Map) _registeredFactoryNames.get(classLoader);
The problem is the second line. Since classloader refers to the newly loaded classloader, factoryClassNames is always null.
Does anybody have a workaround for this? I will log this as an issue since using Classloaders as a Map key is not a very portable way to store the data.
Any help/workarounds would be greatly appreciated.
Adam Brod
Product Development Team
| "Jesse Alexander \(KBSA
21\)" <[EMAIL PROTECTED]>
02/11/2006 05:43 PM
|
|
The problem you mention (and the code you found) were needed for WLS-versions
prior to 8.1.4 From that patchlevel on a patch has been added to WLS to fix the
contextlistener-init problem.
I just deployed the MyFaces simple application (just had to remove the
description tags from the context-params, nothing else) as an exploded
webapp to the autodeploy directory. Every change to a jsp-file was immediately
recognized and resulted in a different html-view...
Hmm... what could be the differences?
I use OpenSuse 10.0 (linux) and a 9.0 download from yesterday evening.
regards
Alexander
From: Adam Brod [mailto:[EMAIL PROTECTED]
Sent: Friday, February 10, 2006 3:43 PM
To: MyFaces Discussion
Subject: Re: MyFaces + Weblogic = Classloading Problems
Yes, I have tried it with and without the context-listener.
Any additional ideas? I'm sure there must be other people developing on weblogic, right?
Adam Brod
Product Development Team
| Martin Marinschek <[EMAIL PROTECTED]>
02/10/2006 12:57 AM
|
|
Have you tried to setup your context-listener in the web.xml directly?
regards,
Martin
On 2/9/06, Adam Brod <[EMAIL PROTECTED]> wrote:
>
> Hi-
>
> I am running into a problem with Classloading with MyFaces 1.1.1 on Weblogic
> 9. Weblogic allows you to deploy your webapp in an exploded directory
> format. That means that you can modify a JSP (or Facelet xhtml) and copy it
> to the deployment directory to be automatically redeployed. This
> functionality works fine in the old Struts/JSP world.
>
> Now that I'm using MyFaces, I'm running into problems with the
> FactoryFinder. As I understand it, FacesServlet or FactoryFinder "stores"
> the Factories based on the current classloader. When Weblogic redeploys a
> JSP, it drops the current ClassLoader and creates a new one. That means
> that the next time I hit a JSF page, I get an IllegalStateException (see
> full stack trace below).
>
> I looked at the code in FacesServlet and I see this comment, "//TODO:
> null-check for Weblogic, that tries to initialize Servlet before
> ContextListener". Obviously I'm not the first to run into this problem. I
> browsed the source of the trunk online and I see the same code is still
> there. Does anybody have a fix for this? Is there any work around other
> than doing a full redeploy for each JSP modification?
>
> Thanks for your help.
>
> Adam
>
>
> java.lang.IllegalStateException: No Factories configured for this
> Application - typically this is because a context listener is not setup in
> your web.xml.
> A typical config looks like this;
> <listener>
>
> <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
> </listener>
>
> at
> javax.faces.FactoryFinder.getFactory(FactoryFinder.java:84)
> at
> javax.faces.webapp.FacesServlet.init(FacesServlet.java:84)
> at
> weblogic.servlet.internal.StubSecurityHelper$ServletInitAction.run(StubSecurityHelper.java:265)
> at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
> at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
> at
> weblogic.servlet.internal.StubSecurityHelper.createServlet(StubSecurityHelper.java:61)
> at
> weblogic.servlet.internal.StubLifecycleHelper.createOneInstance(StubLifecycleHelper.java:58)
> at
> weblogic.servlet.internal.StubLifecycleHelper.(StubLifecycleHelper.java:48)
> at
> weblogic.servlet.internal.ServletStubImpl.prepareServlet(ServletStubImpl.java:502)
> at
> weblogic.servlet.internal.ServletStubImpl.checkForReload(ServletStubImpl.java:429)
> at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:221)
> at
> weblogic.servlet.internal.ServletStubImpl.execute(ServletStubImpl.java:165)
> at
> weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:3022)
> at
> weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:321)
> at
> weblogic.security.service.SecurityManager.runAs(SecurityManager.java:121)
> at
> weblogic.servlet.internal.WebAppServletContext.securedExecute(WebAppServletContext.java:1925)
> at
> weblogic.servlet.internal.WebAppServletContext.execute(WebAppServletContext.java:1848)
> at
> weblogic.servlet.internal.ServletRequestImpl.run(ServletRequestImpl.java:1288)
> at
> weblogic.work.ExecuteThread.execute(ExecuteThread.java:207)
> at weblogic.work.ExecuteThread.run(ExecuteThread.java:179)
>
> Adam Brod
> Product Development Team
>
--
http://www.irian.at
Your JSF powerhouse -
JSF Consulting, Development and
Courses in English and German
Professional Support for Apache MyFaces

