gpt4 book ai didi

jsf - Websphere异常: could not find Factory: javax. faces.context.FacesContextFactory

转载 作者:行者123 更新时间:2023-12-01 18:34:05 27 4
gpt4 key购买 nike

问题是无法找到Factory:javax.faces.context.FacesContextFactory,但位于Websphere 应用程序服务器上。

我有一个 Web 应用程序,它附带了我自己的 jsf impl、Mojarra 2.1.24 和表达式语言 2,但为此我遵循了 IBM 指南 Configuring JavaServer Faces implementation 。正如 IBM 所说,我创建了一个共享文件夹,在其中放置了以下 jar(我从 WEB-INF/lib 中删除了它):

  • el-api.jar
  • el-impl.jar
  • jsf-api.jar
  • jsf-impl.jar
  • jSTL.jar

然后我部署了 Web 应用程序并将共享库链接到 Web 应用程序。

web.xml 如下:

<?xml version="1.0" encoding="utf-8"?>
<web-app xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"
version="3.0">
<context-param>
<param-name>com.sun.faces.enableMissingResourceLibraryDetection</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>com.sun.faces.expressionFactory</param-name>
<param-value>com.sun.el.ExpressionFactoryImpl</param-value>
</context-param>
<context-param>
<param-name>javax.faces.PROJECT_STAGE</param-name>
<param-value>Development</param-value>
</context-param>
<context-param>
<param-name>org.ajax4jsf.handleViewExpiredOnClient</param-name>
<param-value>true</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.CONTROL_SKINNING</param-name>
<param-value>enable</param-value>
</context-param>
<context-param>
<param-name>org.richfaces.skin</param-name>
<param-value>#{applicationBean.skin}</param-value>
</context-param>

<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>/faces/*</url-pattern>
<url-pattern>*.jsf</url-pattern>
<url-pattern>*.faces</url-pattern>
<url-pattern>*.xhtml</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>Resource Servlet</servlet-name>
<servlet-class>org.richfaces.webapp.ResourceServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>Resource Servlet</servlet-name>
<url-pattern>/org.richfaces.resources/*</url-pattern>
</servlet-mapping>
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<mime-mapping>
<extension>ecss</extension>
<mime-type>text/css</mime-type>
</mime-mapping>
<mime-mapping>
<extension>xhtml</extension>
<mime-type>text/html</mime-type>
</mime-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>

应用程序启动产生以下异常:

Caused by: java.lang.IllegalStateException: Could not find backup for factory javax.faces.context.FacesContextFactory. 
at javax.faces.FactoryFinder$FactoryManager.getFactory(FactoryFinder.java:1010)
at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:342)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:302)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:342)
... 26 more

最佳答案

我回答我自己的问题,因为我发现没有关于 Websphere 的其他问题,我想与社区分享我的发现。解决方案是将以下 xml 片段添加到 web.xml 中:

<listener>
<listener-class>com.sun.faces.config.ConfigureListener</listener-class>
</listener>

因为 ServletContainerInitializer Servlet 3.0 功能似乎无法在 Websphere 上运行。

关于jsf - Websphere异常: could not find Factory: javax. faces.context.FacesContextFactory,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22092497/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com