Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

Please see the Spring Extensions home page for a complete list of current projects in Java, .NET and ActionScript. You can also propose one if you want.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
Using @NotNull annotation for validation gives "No handler is defined" Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Using @NotNull annotation for validation gives "No handler is defined"

    Hi!

    I'm trying to use a @org.springmodules.validation.bean.conf.loader.ann otation.handler.NotNull annotation on a property with annotation-based-validator and BeanValidator and get the following in my log:
    Code:
     WARN 06.05 19:33:07:433 (AnnotationBeanValidationConfigurationLoader.java:handleMethodAnnotations:203) - No hanlder is defined for annotation 'org.springmodules.validation.bean.conf.loader.annotation.handler.NotNull'... Annotation will be ignored...
    Other annotations (have tried @NotBlank and @MaxLength) seems to work just fine.

    I'm using spring 2.0.4 and springmodules 0.8.


    -Kaj

  • #2
    This is a know issue in 0.8, a typo in the source. Look into JIRA.

    Comment


    • #3
      Originally posted by spgmx View Post
      This is a know issue in 0.8, a typo in the source. Look into JIRA.

      Thanks for answering! That was good news!

      I have looked in jira, but can't find this issue. If someone have an url, feel free to post it



      -Kaj

      Comment


      • #4
        Now I see... it seems to be only a typo in the warning (see your posting).
        NotNull works for me in 0.8.
        Last edited by spgmx; May 8th, 2007, 03:16 AM.

        Comment


        • #5
          Originally posted by spgmx View Post
          Now I see... it seems to be only a typo in the warning (see your posting).
          NotNull works for me in 0.8.
          Thanks again for answering!

          I have testet a bit more... I see that @NotNull works just fine in testcases but when running my webapp I get this in the log:

          Code:
          WARN 08.05 09:28:33:98 (AnnotationBeanValidationConfigurationLoader.java:handleMethodAnnotations:203) - No hanlder is defined for annotation 'org.springmodules.validation.bean.conf.loader.annotation.handler.NotNull'... Annotation will be ignored...
          I think it is a bit strange that it works just fine in the testcase but not when running the webapp. I run my unittest from eclipse and I have testet running the app both under resin and with mvn jetty:run with same result.


          -Kaj

          Comment


          • #6
            I have tested it in junit.

            In tomcat it does not work at all with an annotation based validator:

            Unable to locate NamespaceHandler for namespace http://www.springmodules.org/validation/bean/validator.

            The webapp does not start

            Comment


            • #7
              Originally posted by spgmx View Post
              Unable to locate NamespaceHandler for namespace http://www.springmodules.org/validation/bean/validator.

              Hi!

              A possible fix for this issue is described in http://forum.springframework.org/showthread.php?t=30092


              -Kaj

              Comment


              • #8
                In 0.8 the handler entry is already there. Does not work too

                Comment


                • #9
                  I had still a commons-lang.jar < V 2.3 in my webapps lib path, this caused the handler not to load under Java 1.6. My unit test suite had already the correct jar.
                  Solved

                  Comment


                  • #10
                    Originally posted by spgmx View Post
                    I had still a commons-lang.jar < V 2.3 in my webapps lib path, this caused the handler not to load under Java 1.6. My unit test suite had already the correct jar.
                    Solved
                    Thanks for the info!

                    I now see
                    Code:
                    WARN 10.05 12:30:34:428 (AnnotationBeanValidationConfigurationLoader.java:handleMethodAnnotations:203) - No hanlder is defined for annotation 'org.springmodules.validation.bean.conf.loader.annotation.handler.NotNull'... Annotation will be ignored...
                     WARN 10.05 12:30:34:433 (AnnotationBeanValidationConfigurationLoader.java:handleMethodAnnotations:203) - No hanlder is defined for annotation 'org.springmodules.validation.bean.conf.loader.annotation.handler.NotNull'... Annotation will be ignored...
                    also when running the testcases. I know I wrote earlier that I only saw this when running the app not the testcases. I might have looked in the wrong log or done some other mistake when chaing the logs.

                    Anyway.. I see this warning both when running the testcases and the app using resin or jetty.

                    i'm on java 1.5.0_07 on osx and are using commons-lang 2.3.

                    My classpath is
                    Code:
                    repository/antlr/antlr/2.7.6/antlr-2.7.6.jar
                    repository/aopalliance/aopalliance/1.0/aopalliance-1.0.jar
                    repository/asm/asm-attrs/1.5.3/asm-attrs-1.5.3.jar
                    repository/asm/asm/1.5.3/asm-1.5.3.jar
                    repository/aspectj/aspectjrt/1.5.3/aspectjrt-1.5.3.jar
                    repository/aspectj/aspectjweaver/1.5.3/aspectjweaver-1.5.3.jar
                    repository/avalon-framework/avalon-framework/4.1.3/avalon-framework-4.1.3.jar
                    repository/cglib/cglib/2.1_3/cglib-2.1_3.jar
                    repository/com/sun/jndi/nis/1.2.1/nis-1.2.1.jar
                    repository/com/sun/jndi/providerutil/1.2.1/providerutil-1.2.1.jar
                    repository/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar
                    repository/commons-collections/commons-collections/3.2/commons-collections-3.2.jar
                    repository/commons-digester/commons-digester/1.7/commons-digester-1.7.jar
                    repository/commons-lang/commons-lang/2.3/commons-lang-2.3.jar
                    repository/commons-logging/commons-logging/1.1/commons-logging-1.1.jar
                    repository/commons-validator/commons-validator/1.3.0/commons-validator-1.3.0.jar
                    repository/dom4j/dom4j/1.6.1/dom4j-1.6.1.jar
                    repository/javax/activation/activation/1.1/activation-1.1.jar
                    repository/javax/mail/mail/1.4/mail-1.4.jar
                    repository/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar
                    repository/javax/servlet/servlet-api/2.3/servlet-api-2.3.jar
                    repository/javax/transaction/jta/1.0.1B/jta-1.0.1B.jar
                    repository/junit/junit/4.3.1/junit-4.3.1.jar
                    repository/ldapjdk/ldapjdk/4.1/ldapjdk-4.1.jar
                    repository/log4j/log4j/1.2.14/log4j-1.2.14.jar
                    repository/logkit/logkit/1.0.1/logkit-1.0.1.jar
                    repository/net/sf/ehcache/ehcache/1.2.3/ehcache-1.2.3.jar
                    repository/org/easymock/easymock/2.2/easymock-2.2.jar
                    repository/org/freemarker/freemarker/2.3.10/freemarker-2.3.10.jar
                    repository/org/hibernate/hibernate-annotations/3.2.1.ga/hibernate-annotations-3.2.1.ga.jar
                    repository/org/hibernate/hibernate/3.2.3.ga/hibernate-3.2.3.ga.jar
                    repository/org/springframework/spring-aspects/2.0.4/spring-aspects-2.0.4.jar
                    repository/org/springframework/spring-beans/2.0.4/spring-beans-2.0.4.jar
                    repository/org/springframework/spring-context/2.0.4/spring-context-2.0.4.jar
                    repository/org/springframework/spring-core/2.0.4/spring-core-2.0.4.jar
                    repository/org/springframework/spring-dao/2.0.4/spring-dao-2.0.4.jar
                    repository/org/springframework/spring-hibernate3/2.0.4/spring-hibernate3-2.0.4.jar
                    repository/org/springframework/spring-jdbc/2.0.4/spring-jdbc-2.0.4.jar
                    repository/org/springframework/spring-mock/2.0.4/spring-mock-2.0.4.jar
                    repository/org/springframework/spring/2.0.4/spring-2.0.4.jar
                    repository/org/springmodules/spring-modules-validation/0.8a/spring-modules-validation-0.8a.jar
                    repository/oro/oro/2.0.8/oro-2.0.8.jar
                    repository/postgresql/postgresql/8.1-407.jdbc3/postgresql-8.1-407.jdbc3.jar
                    repository/rhino/js/1.6R2/js-1.6R2.jar
                    repository/uio-common/uio-common/1.2.11beta1/uio-common-1.2.11beta1.jar
                    repository/uio-ldap/uio-ldap/1.4.7/uio-ldap-1.4.7.jar
                    repository/xml-apis/xml-apis/1.0.b2/xml-apis-1.0.b2.jar
                    Copy/paste from the output when the app startes.


                    -Kaj

                    Comment


                    • #11
                      Those are field annotations and should be used on fields. Like this

                      @MaxLength(value = 2, message = "wrong.size")
                      private String fullName;

                      Comment

                      Working...
                      X