I tried several things and I think I saw all related posts on the forums and I'm still stuck...
I'm trying to make an application using JSF 2 (2.1.3-b01), Richfaces 4 (4.0.0.Final), maven 3 work on WebSphere 7 (188.8.131.52). The application is working fine on tomcat 6 (6.0.28). I'm using m2eclipse to make my maven project work on RAD8.
I had a lot of problems so I made a very simple JSF2 application, and managed to make it work on WebSphere 7 like this:
- a Shared Library containing the JSF2 api and impl defined for the whole server.
- the jsf-api defined as provided in the pom.xml of the WAR
- the jsf-impl provided by the WAR itself
The application starts, the annotations are taken into account, everything is fine.
Then I just tried to add the Richfaces jar to the WAR pom.xml with this:
<!-- Richfaces libs --> <dependency> <groupId>org.richfaces.ui</groupId> <artifactId>richfaces-components-ui</artifactId> <version>4.0.0.Final</version> </dependency> <dependency> <groupId>org.richfaces.core</groupId> <artifactId>richfaces-core-impl</artifactId> <version>4.0.0.Final</version> </dependency> <!-- /Richfaces libs -->
And suddenly I got a lot of errors during my application statup (see attached stacktrace.log for complete log):
config I Initializing Mojarra 2.1.3 (FCS b01) for context '/JsfTest'
application I JSF1048: PostConstruct/PreDestroy annotations present. ManagedBeans methods marked with these annotations will have said annotations processed.
managedbean W JSF1074: Managed bean named 'a4j' has already been registered. Replacing existing managed bean class type org.richfaces.VersionBean with org.richfaces.VersionBean.
managedbean W JSF1074: Managed bean named 'a4jSkin' has already been registered. Replacing existing managed bean class type org.richfaces.skin.SkinBean with org.richfaces.skin.SkinBean.
managedbean W JSF1074: Managed bean named 'richSkin' has already been registered. Replacing existing managed bean class type org.richfaces.skin.SkinBean with org.richfaces.skin.SkinBean.
[22/07/11 11:59:51:658 CEST] 0000001c config E Critical error during deployment:
com.sun.faces.config.ConfigurationException: CONFIGURATION FAILED! duplicate key: class javax.faces.validator.RegexValidator
Caused by: java.lang.IllegalArgumentException: duplicate key: class javax.faces.validator.RegexValidator
Which are the same errors I got first when trying to migrate my whole application...
I see it comes from the JSR-303 Bean Validation libraries. But my application doesn't package any of these libs. And I don't see any dependency coming with Richfaces to put in provided scope about this validations libs...
You can find attached the zip of the maven projects used for the test, and the whole stacktrace.
It's very important for us to make JSF 2 + Richfaces 4 work on WebSphere 7. We are going to use this configuration for a lot of production applications and it should be straightforward...
Any idea would be greatly welcomed !