JBoss AS 7.1.1 not picking up my JSF implementation
Asked Answered
H

2

10

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?

Hydrophobia answered 9/5, 2012 at 14:29 Comment(2)
Did you exclude JBoss 7.1 default JSF jars in jboss-deployment-structure file?Astyanax
I tried, not sure how but I added the following file jboss-deployment-structure.xml to WEB-INF\ The contents I edited in my message above. But it gives an error (also added it to my question above)Hydrophobia
D
2

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.

Ducky answered 5/8, 2012 at 19:19 Comment(2)
Hi, I don't know maven (we use ant to build our projects (and when developing, we jsut use eclipse export) How and with what file do I do what you are saying?Hydrophobia
sorry, I assumed you used maven, you would run that against the pom.xml. Take a look at this Jira, it appears this issue isn't fixed until 7.1.3Ducky
D
1

JBoss AS 7.1.1 is by default with JSF 2, but is backward compatible with JSF 1.2.

I had the same issue and solved it as follow: I used the same jboss-deployment-structure.xml as you and added the following parameter in the web.xml:

<context-param>
 <param-name>org.jboss.jbossfaces.JSF_CONFIG_NAME</param-name>
 <param-value>Mojarra-1.2</param-value>
</context-param>

You don't need the JSF 1.2 JARs in the lib directory (and thus the org.jboss.jbossfaces.WAR_BUNDLES_JSF_IMPL parameter is not needed in web.xml).

Source: http://tapas-tanmoy-bose.blogspot.ch/2014/01/how-to-run-jsf-12-application-in-jboss.html

I suspect JBoss AS 7.1.1 to ignore the excluded modules of jboss-deployment-structure.xml for JSF (but I have org.hibernate as another excluded module which is effectively excluded, proving that the jboss-deployment-structure.xml is taken into account).

Durga answered 11/3, 2016 at 15:59 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.