1 Reply Latest reply on Jul 22, 2011 8:27 AM by fmt

    JSF2 + Richfaces4 + WebSphere7 faces.validator error

    fmt

      Hi,

       

      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 (7.0.0.17). 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.

      Config        W org.richfaces.javascript.ClientServiceConfigParser parse Found JavaScript function definition for class javax.validation.constraints.NotNull, but that class is not presented

      Config        W org.richfaces.javascript.ClientServiceConfigParser parse Found JavaScript function definition for class org.hibernate.validator.constraints.NotEmpty, but that class is not presented

      [...]

      [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

                at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:375)

                at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:225)

      [...]

      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 !

       

      Regards,

      Florian

        • 1. Re: JSF2 + Richfaces4 + WebSphere7 faces.validator error
          fmt

          Ok I found it...

           

          It has nothing to do with richfaces. This is a WebSphere problem when using m2eclipse with the option "Run server with resources within the workspace". in this situation, the jars are loaded twice: once from the WEB-INF/lib folder, and once from the maven repository.

           

          The solution is to check "Run server with resources on Server" instead in the server properties in eclipse. It takes longer to load and republish apps, but it works.

           

          Regards,

          Florian