尝试在Bluemix上的Liberty中运行简单的JSF页面时出现以下错误
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
我的简单JSF页面如下:
<!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>
我在web.xml中的Faces配置如下:
<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>
我没有对Bluemix上Liberty的默认设置进行任何更改,所以我相信它应该加载JSF2.2。我已经尝试按照错误消息中的描述设置监听器,但它没有解决问题。