Page 1 of 2 12 LastLast
Results 1 to 10 of 11

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

  1. #1
    Join Date
    Oct 2004
    Posts
    151

    Default 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. #2
    Join Date
    Mar 2007
    Posts
    561

    Default

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

  3. #3
    Join Date
    Oct 2004
    Posts
    151

    Default

    Quote 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

  4. #4
    Join Date
    Mar 2007
    Posts
    561

    Default

    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 at 02:16 AM.

  5. #5
    Join Date
    Oct 2004
    Posts
    151

    Default

    Quote 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

  6. #6
    Join Date
    Mar 2007
    Posts
    561

    Default

    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

  7. #7
    Join Date
    Oct 2004
    Posts
    151

    Default

    Quote 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

  8. #8
    Join Date
    Mar 2007
    Posts
    561

    Default

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

  9. #9
    Join Date
    Mar 2007
    Posts
    561

    Default

    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

  10. #10
    Join Date
    Oct 2004
    Posts
    151

    Default

    Quote 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

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •