我是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)
Run Code Online (Sandbox Code Playgroud)
web.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>
Run Code Online (Sandbox Code Playgroud)
正如教程中所示,我在Web-Inf/lib中添加了jsf-api和jsf-impl,但谷歌搜索相同我发现jboss有自己的jsf版本可能会污染我的应用程序多个jsf版本.如果是这种情况,那么我该如何解决问题,或者如果我错了,那么错误背后的原因是什么?
只是添加,因为我相信它的jar文件conflit我试图添加从jboss导入的jar文件jboss-5.1.0.GA\server\default\deploy\jbossweb.sar\jsf-libs,仍然都是徒劳的.
请帮忙.
处理冲突的更好方法是在web.xml中添加一个context参数,如下所述:
<context-param>
<param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name>
<param-value>true</param-value>
</context-param>
Run Code Online (Sandbox Code Playgroud)
退房:在WAR中捆绑JSF
| 归档时间: |
|
| 查看次数: |
4443 次 |
| 最近记录: |