4 Replies Latest reply on May 9, 2017 1:27 PM by kimtiago

    Seam dependency with Hibernate Validator

    israel.bgf
      Hi, i started to use the Bean Validation (JSR 303) instead the old Hibernate Validator, so I got the new libraries (the reference Impl, hibernate-validator 4.02), and put in my classpath, now I thought: "well let's, get rid from the old hibernate-validator lib). Surprisingly, i discovered that the FacesMessage.instance().addMessage(), does need that lib at compilation time... weird!

      Eclipse says: "The type org.hibernate.validator.InvalidValue cannot be resolved. It is indirectly referenced from required .class files"

      Is that right? Now do i have to keep the old hibernate-validator lib in my classpath, just for that?

      I'm, using Seam 2.2.0 in tomcat 6.

      Thnks in advance,
        • 1. Re: Seam dependency with Hibernate Validator
          israel.bgf

          After reading a little i found, that there is indeed a dependency to HV:


          https://jira.jboss.org/jira/browse/JBSEAM-3247


          But well.. it IS the hibernate validator, the lastest one. Is it going to be fixed somewhat one day?

          • 2. Re: Seam dependency with Hibernate Validator
            andre.eugenio

            I will be glad to see anything about this topic as well... googling a little I found this topic (https://jira.jboss.org/jira/browse/JBSEAM-4500) about the same problem.

            • 3. Re: Seam dependency with Hibernate Validator
              bsgcic

              I had gotten this too and finally found the cause and solution (at least for my case).


              I got this error after I imported a seam project to a new machine. When creating the Jboss runtime, I wanted to make a change and therefore deleted the first one I created and created a second one of a different name. Then I deleted the 1st runtime in Preferences -> Server -> Runtime Environment


              After much searching for the source of the "The type org.hibernate.validator.InvalidValue cannot be resolved. It is indirectly referenced from required .class files" on the FacesMessage.instance().addMessage() statement.


              I right-clicked on the project and selected properties.


              Then in the Java Build Path menu, Libraries tab, I selected the runtime (which was listed with "unbound" at the end of the name). I clicked on the Edit button. Then just clicked Ok and I could then see all the libraries within the runtime. I clicked OK to close the properties window.  I then selected Clean from the Project menu which cleaned and re-built the project. Whala, the error is now gone. Hope this helps others that may run into this issue.


              Regards,


              Jeff

              • 4. Re: Seam dependency with Hibernate Validator
                kimtiago

                Here's my solution. Put this in your pom.xml

                <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator-legacy</artifactId>
                <version>4.0.2.GA</version>
                </dependency>