JBoss AS 7.1.1 not picking up my JSF implementation

java, jboss7.x, jsf

Solution

Could there be something else that depends on the JSF API? I'm not sure why it would be different between JBoss and Tomcat, but try running mvn dependency:tree and mvn dependency:analyze with and without the JSF excluded.

Problem

When I deploy my .war file in JBoss AS 7.1.1 and call ``` FacesContext.class.getPackage().getImplementationTitle() ``` and ``` FacesContext.class.getPackage().getImplementationVersion() ``` I get a different version then when I deploy it on tomcat. JBoss: JSF JavaServer Faces API 2.0.1.Final Tomcat: JSF Mojarra 2.0.6-FCS It seems JBoss is not picking the correct JARs that I have in my `WEB-INF\lib\`. This causes different behaviour in my website. I tried to solve the problem with ``` <context-param> <param-name>org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL</param-name> <param-value>true</param-value> </context-param> ``` But that didn't work. I read Alternative JSF implementation with JBoss 71 but apparently it is not solved in 7.1.1. I added `jboss-deployment-structure.xml` to `WEB-INF\` with the following content. ``` <jboss-deployment-structure> <deployment> <exclusions> <module name="javax.faces.api" slot="main"/> <module name="com.sun.jsf-impl" slot="main"/> </exclusions> <dependencies> <module name="org.apache.commons.logging" /> <module name="org.apache.commons.collections" /> <module name="org.apache.log4j" /> <module name="org.dom4j" /> <module name="javax.faces.api" slot="1.2"/> <module name="com.sun.jsf-impl" slot="1.2"/> </dependencies> </deployment> </jboss-deployment-structure> ``` But then my app is not deployed and I get the following errors in `server.log`: ``` 14:06:14,733 SEVERE [javax.enterprise.resource.webcontainer.jsf.config] (MSC service thread 1-4) Critical error during deployment: : com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! Class org.jboss.as.web.deployment.jsf.JandexAnnotationProvider is not an instance of com.sun.faces.spi.AnnotationProvider at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:357) [jsf-impl.jar:2.0.6-FCS] ``` How can I solve my problem?

Original source