0

I am getting the following error when trying to run a simple JSF page in Liberty on Bluemix

App/0
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:226)
2016-03-29T09:34:01.018-0400
App/0
A typical config looks like this;
2016-03-29T09:34:01.018-0400
App/0
<listener>
2016-03-29T09:34:01.018-0400
App/0
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.
2016-03-29T09:34:01.018-0400
App/0
at javax.faces.FactoryFinder._getFactory(FactoryFinder.java:306)
2016-03-29T09:34:01.018-0400
App/0
at [internal classes]
2016-03-29T09:34:01.019-0400
App/0
</listener>
2016-03-29T09:34:01.018-0400
App/0
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:115)
2016-03-29T09:34:01.018-0400
App/0
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332)
2016-03-29T09:34:01.018-0400
App/0
[ERROR ] SRVE0271E: Uncaught init() exception created by servlet [Faces Servlet] in application [myapp]: 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!
2016-03-29T09:34:01.018-0400
App/0
<listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
2016-03-29T09:34:01.018-0400

My simple JSF page is as follows:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
    xmlns:ui="http://java.sun.com/jsf/facelets"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core" >
<h:head></h:head>
<h:body>
    Inside the define content template
    <h:outputText value="My Fit Account @ PNC JSF"/>
    <h:outputText value="Testing JSF in BlueMix"/>
</h:body>
</html>

And my Faces configuration in web.xml is as follows:

  <servlet>
    <servlet-name>Faces Servlet</servlet-name>
    <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Faces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>

I have made no changes to the default setup of Liberty on Bluemix so I believe it should have JSF2.2 loaded. I have tried setting up the listener as described in the error message, but it did not resolve the issue.

Umberto Manganiello
  • 3,213
  • 9
  • 16
JRitz
  • 1
  • Hello. Do you notice another exception in the logs before that one happens? The particular error you posted tends to happen if an exception occurred during the initialization of MyFaces. – hwibell Mar 29 '16 at 18:44
  • 3
    Also, are you using the jsf-2.2 feature that Liberty provides or are you including your own MyFaces implementation either in WEB-INF/lib or as a shared library? If you are using Liberty's jsf-2.2 feature, please make sure you are including the feature in your server.xml. Otherwise, for the third party implementation case, make sure you add org.apache.myfaces.webapp.StartupServletContextListener as a listener (as suggested by the error message you posted above). – hwibell Mar 29 '16 at 19:23

0 Answers0