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

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

    Hi,everyone:
    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">
    <props>
    <prop key="/register.html">loginController</prop>
    <prop key="/index.html">indexController</prop>
    </props>
    </property>
    </bean>

    <bean id="validatorFactory" class="org.springmodules.validation.commons.Defaul tValidatorFactory">
    <property name="validationConfigLocations">
    <list>
    <value>WEB-INF/validator-rules.xml</value>
    <value>WEB-INF/validation.xml</value>
    </list>
    </property>
    </bean>
    <bean id="beanValidator" class="org.springmodules.validation.commons.Defaul tBeanValidator">
    <property name="validatorFactory" ref="validatorFactory" />
    </bean>

    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" />
    </bean>

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

    </form>
    </formset>
    </form-validation>

    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"/>
    </form>

    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 lidator@4bfe6b] 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.
Working...
X