2 Replies Latest reply on Apr 24, 2009 6:43 AM by janusz.gren

    rich:ajaxValidator without Hibernate

    janusz.gren

      Hello,

      From what I understood from the decription it is possible to use whe rich:ajaxValidator without HibernateValidator support - in my application however this seems to be throw an exception every time.

      I'm using standard JPA - TopLink as my persistance provider and I'm validating my input texts like this:

      <h:outputLabel for="username" value="#{msgs.userName}" />
      <h:inputText id="username" value="#{sessionBean.user.login}" required="true">
      <f:validateLength minimum="3" maximum="12"/>
      <rich:ajaxValidator event="onblur" />
      </h:inputText>
      <rich:message for="username" />
      


      This code works perfectly when the application is loaded and fields empty.
      On 1st onblur event - I get a message that the field is required, however when all of the conditions are met and another onblur event is triggered I get the following exception

      HTTP Status 500 -

      type Exception report

      message

      descriptionThe server encountered an internal error () that prevented it from fulfilling this request.

      exception

      javax.servlet.ServletException: PWC1244: Servlet execution threw an exception

      root cause

      java.lang.NoClassDefFoundError: org/hibernate/validator/ClassValidator

      root cause

      java.lang.ClassNotFoundException: org.hibernate.validator.ClassValidator

      Thanks in advance for your replies.
      Janusz

        • 1. Re: rich:ajaxValidator without Hibernate
          ilya_shaikovsky

          use

           <dependency>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-validator</artifactId>
           <version>3.1.0.CR1</version>
           </dependency>
          


          or use a4j:support with bypassupdates=true instead of a4j:ajaxValidator. (It will be the same validation but without Bean Validator registration)

          • 2. Re: rich:ajaxValidator without Hibernate
            janusz.gren

            Thanks!

            It turned out that I had to add more than just the validator but after adding most of the hibernate jars the exception went away.

            Seems kind of redundant though to be forced to include classes that you do not use anyway.

            Janusz