项目使用的myfaces的版本是1.1.5,有点老,要求迁移到JBoss 4.2.3,但是JBoss 4.2.×里面JSF的实现是集成的JSF1.2,这样就出现了JSF实现的冲突。由于改项目里的myfaces,代价太大,所以注释掉JBoss里JSF的实现...具体实现如下:
JBoss里的修改-
Step 1 . Comment out the JSF related in JBOSS_HOME/server/default/deploy/jboss-web.deployer/conf/web.xml.
-----------------------------------
<!-- JBossInjectionProvider provides resource injection for managed beans. -->
<!-- See JSF 1.2 spec section 5.4 for details. -->
<context-param>
<param-name>com.sun.faces.injectionProvider</param-name>
<param-value>org.jboss.web.jsf.integration.injection.JBossInjectionProvider</param-value>
</context-param>
-----------------------------------
<!-- Configures JSF for a web application if the javax.faces.webapp.FacesServlet is declared -->
<!-- in web.xml. -->
<listener>
<listener-class>org.jboss.web.jsf.integration.config.JBossJSFConfigureListener</listener-class>
</listener>
-----------------------------------
<!-- Listens to all web app lifecycle events so that @PreDestroy can be called on -->
<!-- JSF managed beans that go out of scope. You can comment this out if you -->
<!-- don't use JSF or you don't use annotations on your managed beans. -->
<listener>
<listener-class>com.sun.faces.application.WebappLifecycleListener</listener-class>
</listener>
----------------------------------
<!-- Specify the jars relative to the jbossweb-tomcat6.sar that should
be scanned for common tag lib descriptors to include in every war
deployment. -->
<init-param>
<description>JSF standard tlds</description>
<param-name>tagLibJar0</param-name>
<param-value>jsf-libs/jsf-impl.jar</param-value>
</init-param>
Step 2. Delete jsf-impl.jar and jsf-api.jar from JBOSS_HOME/server/default/deploy/jboss-web.deployer/jsf-libs/
项目里的修改-
<!---->
Add below to web.xml:
<!-- This used for JBoss4.2.* and JBoss5 -->
< context-param >
< param-name > org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL </ param-name >
< param-value > true </ param-value >
</ context-param >
这样就屏蔽了JBoss里JSF的实现,而使用项目里的JSF实现。
注意:此方法只是对myfaces 1.1.5有效,对于myfaces 1.2尝试的结果是:后台没有报错,但是页面出不来。目前没有时间深究...
试验了下:jboss-portal-2.6.4 + myfaces 1.2.2, 去掉jboss-portal-2.6.4里面jsf实现,running fine...