Announcement Announcement Module

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions ( project, this forum has been decommissioned in favour of Spring Extensions one at:

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.

Costin Leau
SpringSource - Spring Training, Consulting, and Support - "From the Source"
See more
See less
ValangValidator injection needs ServletContext? Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • ValangValidator injection needs ServletContext?

    I'm a bit stumped. I've used the ValangValidator explicitly in my java code and I'm now trying to remove the code and instead use the standard bean injection framework.

    So now my java code is replaced with:

    <bean id="testValidator" autowire="no" class="org.springmodules.validation.valang.ValangV alidator">
    <property name="valang">
    { firstName : length(?) < 30 : 'First name too long' }

    This is a batch job.... but for some reason when initializing the bean this way I'm getting the error:

    Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/ServletContext

    I'd rather not include a jar that's not needed. I'm not sure why it needs this when I didn't need it when I explicitly new'ed the class. I thought maybe it was autowiring something, but that doesn't seem to be that case.

    Has anyone seen this before? What am I missing?


  • #2
    It looks like we need to add it to the pom.xml anyway.


    and also


    notice the runtime scope for spring-web.

    Refer to the spring-batch-samples pom.
    Last edited by DKLEO; Dec 11th, 2013, 02:20 PM.