gpt4 book ai didi

java - 在 Jboss 5.0 上启动 JSF 应用程序时出错

转载 作者:搜寻专家 更新时间:2023-11-01 02:12:25 25 4
gpt4 key购买 nike

我是 JSF 的新手,我最近开始学习教程。我完全按照教程中提供的信息创建了应用程序。但是,当我启动服务器时,出现以下错误:

Exception sending context initialized event to listener instance of class org.jboss.web.jsf.integration.config.JBossJSFConfigureListener
java.lang.ClassCastException: com.sun.faces.config.WebConfiguration cannot be cast to com.sun.faces.config.WebConfiguration
at com.sun.faces.config.WebConfiguration.getInstance(WebConfiguration.java:154)
at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:145)

网络.xml

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<display-name>Hello, World</display-name>
<description>Welcome to JavaServerFaces</description>

<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>
</servlet-mapping>

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

</web-app>

如教程中所述,我已经在 Web-Inf/lib 中添加了 jsf-api 和 jsf-impl,但是通过谷歌搜索我发现 jboss 有它自己的 jsf 版本,这可能会污染我的应用程序的多个 jsf 版本。如果是这种情况,那么我该如何解决问题,或者如果我错了,那么错误背后的原因是什么?

只是添加,因为我相信它的 jar 文件冲突我已经尝试添加从 jboss-5.1.0.GA\server\default\deploy\jbossweb.sar\jsf 导入的 jar 文件-libs,仍然是徒劳的。

请帮忙。

最佳答案

处理冲突的更好方法是在 web.xml 中添加上下文参数,如下所述:

<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>

checkout :Bundling JSF Inside Your WAR

关于java - 在 Jboss 5.0 上启动 JSF 应用程序时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15941535/

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