Announcement Announcement Module
No announcement yet.
HELP: java.lang.IllegalArgumentException does not support command class Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • HELP: java.lang.IllegalArgumentException does not support command class

    i'm studying spring controller and get the exception when i try to validate a
    SimpleFormController with XML based validator.
    the springweb-servlet.xml :
    <bean id="simpleUrlMapping" class="org.springframework.web.servlet.handler.Sim pleUrlHandlerMapping">
    <property name="mappings">
    <prop key="/register.html">loginController</prop>
    <prop key="/index.html">indexController</prop>

    <bean id="validatorFactory" class="org.springmodules.validation.commons.Defaul tValidatorFactory">
    <property name="validationConfigLocations">
    <bean id="beanValidator" class="org.springmodules.validation.commons.Defaul tBeanValidator">
    <property name="validatorFactory" ref="validatorFactory" />

    the springweb-service.xml :
    <bean id="loginController" class="springweb.LoginController" scope="prototype">
    <property name="formView" value="register" />
    <property name="successView" value="index" />
    <property name="commandName" value="userCommand"/>
    <property name="commandClass" value="springweb.User"/>
    <property name="ud" ref="userDao" />
    <property name="validator" ref="beanValidator" />

    the validation.xml
    <form name="userCommand">
    <field property="id" depends="required">
    <arg0 key="id" />
    <field property="name" depends="required">
    <arg0 key="name" />


    the jsp form:
    <form action="register.html" method="post" name=userCommand>
    Id:<input name="id"/>
    <br>Name:<input name="name">
    <br><input type="submit" value="submit"/>

    the exception detail is:
    org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'loginController' defined in ServletContext resource [/WEB-INF/springweb-service.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Validator [org.springmodules.validation.commons.DefaultBeanVa [email protected]] does not support command class [springweb.User]

    i have googled the exception, but cannot find anything conclusive.
    by the way, in the springweb-servlet.xml file, the validators i used is from org.springmodules.validation.commons package; but all the reference i have says they should come from org.springmodules.commons.validator package.
    but when i download the spring-modules0.9, i cannot find the exact package, is it deprecated or i have something wrong?
    Could anyone help me?
    Thanks a lot.