1 2 3 4 5 Previous Next 63 Replies Latest reply on Dec 11, 2007 4:57 AM by pmuir Go to original post
      • 30. Re: Seam Email - IllegalStateException: No Factories configu
        pmuir

        So, I've run into this (in anger) as well now.

        1) Facelets scans the classpath for .taglib.xml files inside of META-INF, and loads them if it finds them (thats what all the load implicit stuff you see is).

        2) The UCL doesn't scan WEB-INF/lib (as this is a special war thing).

        So, if you get the UCL instead of the WebAppClassLoader then it don't work. And, I found that even if the classloader inside FaceletsRenderer is the WACL then the UCL may be used to initialise facelets.

        • 31. Re: Seam Email - IllegalStateException: No Factories configu
          pmuir

           

          And, I found that even if the classloader inside FaceletsRenderer is the WACL then the UCL may be used to initialise facelets.


          Oops, no, thats not right...

          • 32. Re: Seam Email - IllegalStateException: No Factories configu


            So, I've run into this (in anger) as well now.

            1) Facelets scans the classpath for .taglib.xml files inside of META-INF, and loads them if it finds them (thats what all the load implicit stuff you see is).

            2) The UCL doesn't scan WEB-INF/lib (as this is a special war thing).

            So, if you get the UCL instead of the WebAppClassLoader then it don't work. And, I found that even if the classloader inside FaceletsRenderer is the WACL then the UCL may be used to initialise facelets.


            Yeah - I looked at the facelets source code - by hacking it to show the classloader, that's where I ultimately discovered that two different classloaders are being used (but I still don't know why this occurs - I could understand if the UCL is always being used and thus usage always fails - but not why sometimes the WACL is being used???).

            Anyway, now we come to why I suggested maybe putting a hack on facelets to try and force it to use the WACL only by using the ServletContext's classloader .... any thoughts?

            Thanks,
            Brad Smith

            • 33. Re: Seam Email - IllegalStateException: No Factories configu
              pmuir

              The WACL should *always* be used as jsf-facelets.jar is in WEB-INF/lib.

              We don't think its facelets that is the problem, but probably JBoss AS. Anyway, I now have a reasonably simple working testcase of this going wrong (I just need to tidy it up a bit and make it easier to run) - hopefully i'll get there tonight with that. Then we'll get some AS guys involved to try and sort out what is going wrong.

              I'll post a link to JIRA once I put an issue in here :)

              • 34. Re: Seam Email - IllegalStateException: No Factories configu

                have you managed to gain any new insight into this?

                Thanks,
                Brad Smith

                • 35. Re: Seam Email - IllegalStateException: No Factories configu
                  pmuir

                  Sorry, I got quite a long way last night sorting out the example (which shows it) but didn't quite get there, hopefully tonight or if not, sometime on Thursday I'll have a testcase.

                  • 36. Re: Seam Email - IllegalStateException: No Factories configu
                    pmuir

                    Brad, just to keep you updated: I'm still working on the testcase - I should manage to get it all finished tomorrow, so the next time my laptop meets the internet after that there should be a testcase at least :)

                    • 37. Re: Seam Email - IllegalStateException: No Factories configu
                      pmuir
                      • 38. Re: Seam Email - IllegalStateException: No Factories configu
                        pmuir

                        Brad, is this working for you now?

                        • 39. Re: Seam Email - IllegalStateException: No Factories configu

                          Pete,

                          Sorry about the late response - anyway, so far, so good - your change to the classloader appears to have solved the problem. I haven't hit all my use cases yet, but the ones I have (about 50%) are working now. If you recall our discussion about where the jars go, I've now successfully removed the jars that I were both in the ear and war - only the war has things like facelets, seam-mail, etc.

                          Thanks,

                          Brad Smith

                          • 40. Re: Seam Email - IllegalStateException: No Factories configu
                            suganda

                            i also get same error when using jsf with jboss

                            2007-03-21 17:42:50,281 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/PowerPortlet].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
                            java.lang.NullPointerException
                             at javax.faces.component.UIComponentBase.getRenderer(UIComponentBase.java:524)
                             at javax.faces.component.UIComponentBase.getClientId(UIComponentBase.java:136)
                             at javax.faces.component.UIComponentBase.getClientId(UIComponentBase.java:129)
                             at com.sun.rave.web.ui.component.TableRowGroup.getProperties(TableRowGroup.java:1804)
                             at com.sun.rave.web.ui.component.TableRowGroup.restoreState(TableRowGroup.java:1490)
                             at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:511)
                             at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
                             at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
                             at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
                             at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
                             at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
                             at javax.faces.component.UIComponentBase.processRestoreState(UIComponentBase.java:502)
                             at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreComponentState(JspStateManagerImpl.java:129)
                             at org.apache.myfaces.application.jsp.JspStateManagerImpl.restoreView(JspStateManagerImpl.java:185)
                             at org.apache.myfaces.application.jsp.JspViewHandlerImpl.restoreView(JspViewHandlerImpl.java:255)
                             at com.sun.rave.web.ui.appbase.faces.ViewHandlerImpl.restoreView(ViewHandlerImpl.java:310)
                             at org.apache.myfaces.lifecycle.LifecycleImpl.restoreView(LifecycleImpl.java:124)
                             at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:66)
                             at javax.faces.webapp.FacesServlet.service(FacesServlet.java:106)
                             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
                             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                             at com.sun.rave.web.ui.util.UploadFilter.doFilter(UploadFilter.java:198)
                             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                             at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
                             at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
                             at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
                             at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
                             at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
                             at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:175)
                             at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:74)
                             at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
                             at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
                             at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
                             at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
                             at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
                             at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
                             at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
                             at org.apache.tomcat.util.net.MasterSlaveWorkerThread.run(MasterSlaveWorkerThread.java:112)
                             at java.lang.Thread.run(Thread.java:595)
                            


                            i can show table from database
                            HOWEVER
                            when i refresh table i got that error

                            whats wrong with faces ?
                            it is similar to
                            http://wiki.jboss.org/wiki/Wiki.jsp?page=JBossWithIntegratedMyFaces

                            but i already attempt all of the clue in there and still get the same error
                            help me............


                            thanks
                            ganda:)

                            • 41. Re: Seam Email - IllegalStateException: No Factories configu
                              pmuir

                              AFAICS this has nothing to do with Seam email support. so please start a new topic

                              • 42. Re: Seam Email - IllegalStateException: No Factories configu
                                konikoni

                                Hello, i get the same exception:

                                16:40:42,818 ERROR [STDERR] java.lang.IllegalStateException: No Factories configured for this Application. This happens if the faces-initialization does not work at all - make sure that you properly include all configuration settings necessary for a basic faces application and that all the necessary libs are included. Also check the logging output of your web application and your container for any exceptions!
                                If you did that and find nothing, the mistake might be due to the fact that you use some special web-containers which do not support registering context-listeners via TLD files and 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>
                                16:40:42,818 ERROR [STDERR] at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:90)
                                16:40:42,818 ERROR [STDERR] at org.jboss.seam.mock.MockFacesContext.<init>(MockFacesContext.java:62)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer$Context.wrap(FaceletsRenderer.java:59)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:110)
                                16:40:42,819 ERROR [STDERR] at kk.rentform.session.mailprocessor.AsynchronousMailProcessor.scheduleSend(AsynchronousMailProcessor.java:20)
                                16:40:42,819 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                16:40:42,819 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                                16:40:42,819 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                16:40:42,819 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.interceptors.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:34)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.interceptors.AsynchronousInterceptor.aroundInvoke(AsynchronousInterceptor.java:37)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
                                16:40:42,819 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:151)
                                16:40:42,820 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:87)
                                16:40:42,820 ERROR [STDERR] at kk.rentform.session.mailprocessor.AsynchronousMailProcessor_$$_javassist_89.scheduleSend(AsynchronousMailProcessor_$$_javassist_89.java)16:40:42,820 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
                                16:40:42,820 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
                                16:40:42,820 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
                                16:40:42,820 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585)
                                16:40:42,820 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
                                16:40:42,820 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
                                


                                I use jboss 4.0.5GA + Jboss Seam build tonight.



                                • 43. Re: Seam Email - IllegalStateException: No Factories configu
                                  pmuir

                                  Is this using the mail example?

                                  • 44. Re: Seam Email - IllegalStateException: No Factories configu
                                    konikoni

                                    No,


                                    code:


                                    Session:

                                    import kk.rentform.session.mailprocessor.AsynchronousMailProcessor;
                                    
                                    @Name("regist")
                                    @Scope(ScopeType.CONVERSATION)
                                    @Stateless
                                    public class Regist implements RegistInterface{
                                     @In
                                     private Usr usr;
                                    
                                     @PersistenceContext
                                     private EntityManager em;
                                    
                                     @In
                                     private FacesMessages facesMessages;
                                    
                                     @Logger
                                     private Log log;
                                    
                                     @In
                                     private AsynchronousMailProcessor asynchronousMailProcessor;
                                    
                                     @In
                                     private Crypt crypt;
                                    
                                     public String regist(){
                                     if ( ! usr.getPasswort().equals(usr.getPasswort1()) ){
                                     facesMessages.add("Passwörter sind nicht gleich!");
                                     return null;
                                     }
                                    
                                    
                                    
                                     List ls = em.createQuery("select u.email from Usr u where u.email = :email")
                                     .setParameter("email",usr.getEmail())
                                     .getResultList();
                                    
                                     if ( !ls.isEmpty() ){
                                     facesMessages.add("Email Adresse existiert bereits!");
                                     return null;
                                     }
                                    
                                     List lsb = em.createQuery("select u.bname from Usr u where u.bname = :bname")
                                     .setParameter("bname",usr.getBname())
                                     .getResultList();
                                     if ( !lsb.isEmpty() ){
                                     facesMessages.add("Benutzername existiert bereits!");
                                     return null;
                                     }
                                     usr.setActive(false);
                                     usr.setSperr(false);
                                     String zf = crypt.generate();
                                     usr.setGennumber(zf);
                                     usr.setRoles("user");
                                     try{
                                     em.persist(usr);
                                     asynchronousMailProcessor.scheduleSend(3000, usr);
                                     return "/registok.xhtml";
                                    
                                     }catch(Exception e){
                                     log.error("---------------- Error : " + e.getMessage());
                                     log.error(e.getStackTrace());
                                     facesMessages.add("Registrierung fehlgeschlagen, versuchen es später nochmal.");
                                     return null;
                                     }
                                    
                                    
                                     }
                                    
                                    }
                                    



                                    I use this a class from example:


                                    import kk.rentform.entity.Usr;
                                    import org.jboss.seam.annotations.Asynchronous;
                                    import org.jboss.seam.annotations.AutoCreate;
                                    import org.jboss.seam.annotations.Name;
                                    import org.jboss.seam.annotations.timer.Duration;
                                    import org.jboss.seam.contexts.Contexts;
                                    import org.jboss.seam.core.Events;
                                    import org.jboss.seam.core.Renderer;
                                    
                                    @Name("asynchronousMailProcessor")
                                    @AutoCreate
                                    public class AsynchronousMailProcessor
                                    {
                                     @Asynchronous
                                     public void scheduleSend(@Duration long delay,Usr usr) {
                                     try {
                                     Contexts.getEventContext().set("usr", usr);
                                     Renderer.instance().render("/emailtemplates/registmsg.xhtml");
                                     } catch (Exception e) {
                                     e.printStackTrace();
                                     }
                                     }
                                    }
                                    

                                    
                                    <m:message xmlns="http://www.w3.org/1999/xhtml"
                                     xmlns:m="http://jboss.com/products/seam/mail"
                                     xmlns:h="http://java.sun.com/jsf/html">
                                    
                                     <m:from name="xxx" address="xxx" />
                                     <m:to name="#{usr.firma}"> #{usr.email}</m:to>
                                     <m:subject>Registrierung</m:subject>
                                     <m:body>
                                     <p>Sehr geehrte Damen und Herren,</p>
                                    
                                     <p>Um Ihre Registrierung bei rentform.de vervollständigen zu können, ist es notwendig Ihren Account freizuschalten.</p>
                                     <p>Klicken Sie auf den folgenden Link: </p>
                                    
                                     <p>Klicken Sie auf den folgenden Link: </p>
                                    
                                     <p>Peter</p>
                                     </m:body>
                                    </m:message>