JSF在Liberty Bluemix中不工作

JSF在Liberty Bluemix中不工作,jsf,ibm-cloud,websphere-liberty,Jsf,Ibm Cloud,Websphere Liberty,在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

在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
App/0
位于javax.faces.FactoryFinder.getFactory(FactoryFinder.java:226)
2016-03-29T09:34:01.018-0400
应用程序/0
一个典型的配置如下所示;
2016-03-29T09:34:01.018-0400
应用程序/0
2016-03-29T09:34:01.018-0400
应用程序/0
如果您这样做了,但什么也没找到,那么错误可能是因为您使用了一些特殊的web容器,这些容器不支持通过TLD文件注册上下文侦听器,并且您的web.xml中没有设置上下文侦听器。
2016-03-29T09:34:01.018-0400
应用程序/0
在javax.faces.FactoryFinder.\u getFactory(FactoryFinder.java:306)
2016-03-29T09:34:01.018-0400
应用程序/0
在[内部课程]
2016-03-29T09:34:01.019-0400
应用程序/0
2016-03-29T09:34:01.018-0400
应用程序/0
位于javax.faces.webapp.FacesServlet.init(FacesServlet.java:115)
2016-03-29T09:34:01.018-0400
应用程序/0
位于com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:332)
2016-03-29T09:34:01.018-0400
应用程序/0
[错误]SRVE0271E:未捕获init()异常由应用程序[myapp]:java.lang.IllegalStateException中的servlet[Faces servlet]创建:未为此应用程序配置工厂。如果faces初始化根本不起作用,则会发生这种情况-确保正确包含基本faces应用程序所需的所有配置设置,并且包含所有必要的LIB。还要检查web应用程序和容器的日志输出是否存在任何异常!
2016-03-29T09:34:01.018-0400
应用程序/0
org.apache.myfaces.webapp.StartupServletContextListener
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>
  <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>

在“定义内容”模板中
web.xml中的my Faces配置如下:

<!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>
  <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>

Facesservlet
javax.faces.webapp.FacesServlet
1.
Facesservlet
*.xhtml

我没有对Bluemix上Liberty的默认设置进行任何更改,因此我认为应该加载JSF2.2。我已尝试按照错误消息中的说明设置侦听器,但没有解决问题。

您好。在此之前,您是否注意到日志中的另一个异常?如果在MyFaces初始化过程中发生异常,则可能会出现您发布的特定错误。此外,您是否使用Liberty提供的jsf-2.2功能,或者您是否将自己的MyFaces实现包含在WEB-INF/lib中或作为共享库?如果您正在使用Liberty的jsf-2.2功能,请确保在server.xml中包含该功能。否则,对于第三方实现案例,请确保添加org.apache.myfaces.webapp.StartupServletContextListener作为侦听器(如上面发布的错误消息所示)。