当前位置: 首页 > 知识库问答 >
问题:

JSF不在WebSphere Liberty配置文件上工作

刁英朗
2023-03-14
[ERROR   ] An error occured while initializing MyFaces: org.apache.myfaces.spi.impl.DefaultFacesConfigurationMergerFactory cannot be cast to org.apache.myfaces.spi.FacesConfigurationMergerFactory
[ERROR   ] Uncaught.init.exception.thrown.by.servlet
[ERROR   ] SRVE0266E: Error occured while initializing servlets: javax.servlet.ServletException: SRVE0207E: Uncaught initialization exception created by servlet
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:382)
    at com.ibm.ws.webcontainer.osgi.servlet.ServletWrapper.init(ServletWrapper.java:83)
    at com.ibm.ws.webcontainer.servlet.ServletWrapper.loadOnStartupCheck(ServletWrapper.java:1353)
    at com.ibm.ws.webcontainer.webapp.WebApp.doLoadOnStartupActions(WebApp.java:862)
    at com.ibm.ws.webcontainer.webapp.WebApp.commonInitializationFinally(WebApp.java:831)
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:753)
    at com.ibm.ws.webcontainer.webapp.WebApp.initialize(WebApp.java:5694)
    at com.ibm.ws.webcontainer.osgi.DynamicVirtualHost.createRunnableHandler(DynamicVirtualHost.java:220)
    at com.ibm.ws.http.internal.VirtualHostImpl.discriminate(VirtualHostImpl.java:165)
    at com.ibm.ws.http.dispatcher.internal.channel.HttpDispatcherLink.ready(HttpDispatcherLink.java:157)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleDiscrimination(HttpInboundLink.java:444)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.handleNewRequest(HttpInboundLink.java:378)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.processRequest(HttpInboundLink.java:278)
    at com.ibm.ws.http.channel.internal.inbound.HttpInboundLink.ready(HttpInboundLink.java:249)
    at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.sendToDiscriminators(NewConnectionInitialReadCallback.java:174)
    at com.ibm.ws.tcpchannel.internal.NewConnectionInitialReadCallback.complete(NewConnectionInitialReadCallback.java:83)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.requestComplete(WorkQueueManager.java:502)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.attemptIO(WorkQueueManager.java:550)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager.workerRun(WorkQueueManager.java:899)
    at com.ibm.ws.tcpchannel.internal.WorkQueueManager$Worker.run(WorkQueueManager.java:981)
    at com.ibm.ws.threading.internal.Worker.executeWork(Worker.java:398)
    at com.ibm.ws.threading.internal.Worker.run(Worker.java:380)
    at java.lang.Thread.run(Unknown Source)
Caused by: 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!
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.
A typical config looks like this;
<listener>
  <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
</listener>

at javax.faces.FactoryFinder.getFactory(FactoryFinder.java:172)
at javax.faces.webapp.FacesServlet.init(FacesServlet.java:112)
at com.ibm.ws.webcontainer.servlet.ServletWrapper.init(ServletWrapper.java:320)
... 22 more

我的web.xml是由eclipse生成的,看起来如下所示:

<?xml version="1.0" encoding="UTF-8"?>
<web-app id="WebApp_ID" version="3.0" 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">
    <display-name>WAS-Liberty-Test</display-name>
    <context-param>
        <param-name>javax.servlet.jsp.jstl.fmt.localizationContext</param-name>
        <param-value>resources.application</param-value>
    </context-param>
    <context-param>
        <description>
        State saving method: 'client' or 'server' (=default). See JSF Specification 2.5.2</description>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>client</param-value>
    </context-param>
    <context-param>
        <description>

    This parameter tells MyFaces if javascript code should be allowed in
    the rendered HTML output.
    If javascript is allowed, command_link anchors will have javascript code
    that submits the corresponding form.
    If javascript is not allowed, the state saving info and nested parameters
    will be added as url parameters.
    Default is 'true'</description>
        <param-name>org.apache.myfaces.ALLOW_JAVASCRIPT</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <description>

    If true, rendered HTML code will be formatted, so that it is 'human-readable'
    i.e. additional line separators and whitespace will be written, that do not
    influence the HTML code.
    Default is 'true'</description>
        <param-name>org.apache.myfaces.PRETTY_HTML</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.DETECT_JAVASCRIPT</param-name>
        <param-value>false</param-value>
    </context-param>
    <context-param>
        <description>

    If true, a javascript function will be rendered that is able to restore the
    former vertical scroll on every request. Convenient feature if you have pages
    with long lists and you do not want the browser page to always jump to the top
    if you trigger a link or button action that stays on the same page.
    Default is 'false'
</description>
        <param-name>org.apache.myfaces.AUTO_SCROLL</param-name>
        <param-value>true</param-value>
    </context-param>
    <listener>
        <listener-class>org.apache.myfaces.webapp.StartupServletContextListener</listener-class>
    </listener>
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
        <enabled>true</enabled>
        <async-supported>false</async-supported>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>
        /faces/*</url-pattern>
    </servlet-mapping>
    <welcome-file-list>
        <welcome-file>index.html</welcome-file>
        <welcome-file>index.htm</welcome-file>
        <welcome-file>index.jsp</welcome-file>
        <welcome-file>default.html</welcome-file>
        <welcome-file>default.htm</welcome-file>
        <welcome-file>default.jsp</welcome-file>
    </welcome-file-list>
</web-app>

那么这里的问题是什么呢?

共有1个答案

岳晟
2023-03-14

似乎您既启用了JSF-2.0特性,又在应用程序中绑定了自己的MyFaces副本。

如果您希望使用作为Liberty的一部分提供的JSF-2.0实现,我建议从应用程序中删除MyFaces Jar,并删除集成环境中不需要的StartupServletContextListener。

如果希望使用绑定在应用程序中的jsf实现,可以从server.xml中删除JSF-2.0特性。

 类似资料:
  • 配置文件分为用户级配置和项目级配置。 用户级配置包含用户的环境及 UI 相关的选项,包括: 用户选项 中的所有内容。 扩展工具,包括已配置的扩展列表。 其他工具中的UI相关选项,例如 Target 组件下 站点地图 的选定视图。 项目级配置包含在特定目标应用程序上执行的工作相关的选项,包括: 项目选项中的所有内容。 单个Burp工具中的非UI相关选项,例如 代理 (Proxy) 和 扫描器 (Sc

  • 我更改为配置文件和.htaccess文件。以下文件, Config.php .htaccess 重新启动发动机 秘书长/52322/ 重写Cond%{REQUEST_FILENAME}!-f 重写cond%{REQUEST_FILENAME}-D 重写规则 ^(.*)$ index.php?/1美元[L, QSA] 发生错误在此服务器上找不到请求的URL /52322/login/。 请帮帮我。

  • 问题内容: 我到处都是博客,试图找到如何使用JSF 2.0上传文件,但是所有解决方案都使我感到困惑。我想知道我到底需要什么才能成功上传文件(MP3,PDF,视频…什么类型)并将其作为@Lob存储在数据库中。到目前为止,这是我所做的: 我创建了一个实体,其属性类型为byte [],并且还使用@Lob注释对其进行了注释。 我创建了一个EJB,该EJB将使用带有以byte []作为参数的方法来引入实体,

  • 这就是我遇到麻烦的代码: 错误是: 当我执行脚本时,我没有任何chrome实例,当我使用它时没有选项,它工作正常。知道为什么会这样吗?请注意,我使用的是类似问题中提供的。 我用的是ChromeDriver 86.0.4240.22

  • 配置文件格式 # This is a simple example with comments. [bug_tracker] url = http://localhost:8080/bugs/ username = dhellmann ; You should not store passwords in plain text ; configuration files. password = S

  • 我正在创建一个配置文件页面和一个登录页面,在其中存储会话id,然后在配置文件文件中检查是否设置了isset,但我遇到的问题是,系统总是显示一条错误消息,并且我使用了print\r($\u session);浏览器显示: 重要数据丢失阵列([名字]= 如何修复此错误?????