diff --git a/core/src/main/java/org/apache/struts/action2/jsf/FacesSetupInterceptor.java b/core/src/main/java/org/apache/struts/action2/jsf/FacesSetupInterceptor.java index f5771191b..c6bc72ecc 100644 --- a/core/src/main/java/org/apache/struts/action2/jsf/FacesSetupInterceptor.java +++ b/core/src/main/java/org/apache/struts/action2/jsf/FacesSetupInterceptor.java @@ -57,8 +57,17 @@ public class FacesSetupInterceptor extends FacesSupport implements Interceptor { * Initializes the lifecycle and factories */ public void init() { - facesContextFactory = (FacesContextFactory) FactoryFinder + try { + facesContextFactory = (FacesContextFactory) FactoryFinder .getFactory(FactoryFinder.FACES_CONTEXT_FACTORY); + } catch (Exception ex) { + log.debug("Unable to initialize faces", ex); + } + + if (facesContextFactory == null) { + log.info("Unable to initialize jsf interceptors probably due missing JSF framework initialization"); + return; + } // Javadoc says: Lifecycle instance is shared across multiple // simultaneous requests, it must be implemented in a thread-safe // manner. diff --git a/core/src/test/java/org/apache/struts/action2/views/freemarker/FreemarkerManagerTest.java b/core/src/test/java/org/apache/struts/action2/views/freemarker/FreemarkerManagerTest.java index fe714b178..6860455c1 100644 --- a/core/src/test/java/org/apache/struts/action2/views/freemarker/FreemarkerManagerTest.java +++ b/core/src/test/java/org/apache/struts/action2/views/freemarker/FreemarkerManagerTest.java @@ -18,16 +18,15 @@ package org.apache.struts.action2.views.freemarker; import org.apache.struts.action2.StrutsConstants; +import org.apache.struts.action2.StrutsTestCase; import org.apache.struts.action2.config.Configuration; import org.apache.struts.action2.views.jsp.StrutsMockServletContext; -import junit.framework.TestCase; - /** * Test case for FreemarkerManager * */ -public class FreemarkerManagerTest extends TestCase { +public class FreemarkerManagerTest extends StrutsTestCase { public void testIfStrutsEncodingIsSetProperty() throws Exception { Configuration.set(StrutsConstants.STRUTS_I18N_ENCODING, "UTF-8");