Announcement Announcement Module
No announcement yet.
why NoSuchBeanDefinitionException from spring-sandbox.jar? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • pjydc
    started a topic why NoSuchBeanDefinitionException from spring-sandbox.jar?

    why NoSuchBeanDefinitionException from spring-sandbox.jar?

    I checked out the spring source code from its CVS and built a few jars
    acorrding to spring's build.xml as follows:

    ant modulejars
    ant mockjar
    ant sandbox.jar (637K)

    in the hope that my program runs on the latest version.

    However, I got the following exception when visiting a spring form.

    org.springframework.beans.factory.NoSuchBeanDefini tionException: No unique bean of type [org.springframework.validation.
    commons.ValidatorFactory] is defined: Expected single bean but found 0
    at org.springframework.beans.factory.BeanFactoryUtils .beanOfTypeIncludingAncestors(BeanFactoryUtils.jav a:256)
    at org.springframework.validation.commons.taglib.Java scriptValidatorTag.getValidatorResources(Javascrip tValidato
    at org.springframework.validation.commons.taglib.Java scriptValidatorTag.doStartTag(JavascriptValidatorT
    at org.apache.jsp.scripts.validator_jsp._jspx_meth_ht ml_javascript_0(org.apache.jsp.scripts.validator_j sp:79)
    at org.apache.jsp.scripts.validator_jsp._jspService(o rg.apache.jsp.scripts.validator_jsp:55)

    I have a spring-sandbox.jar (434K) which I got from Matt
    Raible's book, Spring Alive. If I use this spring-sandbox.jar, my program
    works. Can somebody give me an explanation or let me know how to
    resolve this?

    Thanks, Pete

  • pjydc

    Thanks for the information which is very useful. I have figured
    it out why. My web-tier application context needs to be specified
    together the context files for other two tiers.


    Without put /WEB-INF/app-web.xml in the above, my app still works,
    but the validation using the sandbox fails.


    Leave a comment:

  • Alef Arendsen
    You're either not in the context of a Spring controller (the tag first looks in the in the Servlet WebAppCtx - xxx-servlet.xml - and the in your applicationContext.xml - if you're not in the context of a spring controller the xxx-servlet.xml will not be available) or you simply haven't defined a ValidatorFactory.

    The change between the latest version and the version you're using is that Spring first looks in the Servlet webapplicationcontext. It didn't do this before.

    Remember, the sandbox code is subject to change without notice so you should be careful with what you're doing here...

    Alef Arendsen

    Leave a comment: