Could not find javax.faces.context.FacesContextFactory for FaceletsRenderer
btonez Jun 7, 2008 3:00 PMApologies if this is similar to Bernard Hurzeler's MDB mail question, but I felt that this was sufficiently different for its own topic. I'm experiencing the following stack trace when I try to send mail using a Renderer injected into my event-scoped JavaBean:
08:37:05,731 ERROR [STDERR] org.jboss.seam.InstantiationException: Could not instantiate Seam component: org.jboss.seam.ui.facelet.facesContextFactory 08:37:05,731 ERROR [STDERR] at org.jboss.seam.Component.newInstance(Component.java:2090) 08:37:05,731 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1972) 08:37:05,731 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1951) 08:37:05,731 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1928) 08:37:05,731 ERROR [STDERR] at org.jboss.seam.Component.getInstance(Component.java:1923) 08:37:05,731 ERROR [STDERR] at org.jboss.seam.ui.facelet.RendererFacesContextFactory.instance(RendererFacesContextFactory.java:72) 08:37:05,732 ERROR [STDERR] at org.jboss.seam.ui.facelet.RendererRequest.init(RendererRequest.java:52) 08:37:05,732 ERROR [STDERR] at org.jboss.seam.ui.facelet.RendererRequest.run(RendererRequest.java:81) 08:37:05,732 ERROR [STDERR] at org.jboss.seam.ui.facelet.FaceletsRenderer.render(FaceletsRenderer.java:43) 08:37:05,732 ERROR [STDERR] at my.pkg.action.Register.sendActivationEmail(Register.java:95) 08:37:05,732 ERROR [STDERR] at my.pkg.action.Register.submit(Register.java:63) 08:37:05,732 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 08:37:05,732 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 08:37:05,732 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 08:37:05,732 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585) 08:37:05,732 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21) 08:37:05,732 ERROR [STDERR] at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31) 08:37:05,732 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56) 08:37:05,732 ERROR [STDERR] at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31) 08:37:05,732 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 08:37:05,732 ERROR [STDERR] at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:38) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.util.Work.workInTransaction(Work.java:41) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:32) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:166) 08:37:05,733 ERROR [STDERR] at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102) 08:37:05,733 ERROR [STDERR] ... many more (snip) 08:37:05,746 ERROR [STDERR] Caused by: java.lang.IllegalStateException: Application was not properly initialized at startup, could not find Factory: javax.faces.context.FacesContextFactory 08:37:05,746 ERROR [STDERR] at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:256) 08:37:05,746 ERROR [STDERR] at org.jboss.seam.ui.facelet.RendererFacesContextFactory.create(RendererFacesContextFactory.java:47) 08:37:05,746 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 08:37:05,746 ERROR [STDERR] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) 08:37:05,746 ERROR [STDERR] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) 08:37:05,746 ERROR [STDERR] at java.lang.reflect.Method.invoke(Method.java:585) 08:37:05,746 ERROR [STDERR] at org.jboss.seam.util.Reflections.invoke(Reflections.java:21) 08:37:05,746 ERROR [STDERR] at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:125) 08:37:05,746 ERROR [STDERR] at org.jboss.seam.Component.callComponentMethod(Component.java:2195) 08:37:05,747 ERROR [STDERR] at org.jboss.seam.Component.callCreateMethod(Component.java:2118) 08:37:05,747 ERROR [STDERR] at org.jboss.seam.Component.newInstance(Component.java:2078) 08:37:05,747 ERROR [STDERR] ... 90 more
According to the log, I think my components are at least installed OK:
08:36:08,820 INFO [Component] Component: org.jboss.seam.ui.facelet.facesContextFactory, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.ui.facelet.RendererFacesContextFactory 08:36:08,129 INFO [Component] Component: org.jboss.seam.mail.mailSession, scope: APPLICATION, type: JAVA_BEAN, class: org.jboss.seam.mail.MailSession
All of my pages are rendering fine, it's just the mail page. Here's my emailing code if you need it (although I don't think it even impacts the problem):
private boolean sendActivationEmail() { try { code = activation.generateCode(user.getUsername()); renderer.render("WEB-INF/mail/activation.xhtml"); FacesMessages.instance().add( "An activation email was sent to your address."); return true; } catch (Exception e) { FacesMessages.instance().add( "Activation email sending failed; " + "your account is automatically activated " + "and ready to log in."); log.error(e); e.printStackTrace(); return false; } }
Would it matter that the mailing xhtml depends on the event-scoped register
component from which the mail is being sent? Any help would be greatly appreciated.