Announcement Announcement Module
Collapse

Spring Modules forum decommissioned in favor of Spring Extensions

As the Spring Modules project has been replaced by the Spring Extensions (http://www.springsource.org/extensions) project, this forum has been decommissioned in favour of Spring Extensions one at:
http://forum.springsource.org/forumdisplay.php?f=44

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.

Cheers,
Costin Leau
SpringSource - http://www.SpringSource.com- Spring Training, Consulting, and Support - "From the Source"
http://twitter.com/costinl
See more
See less
ValangValidator injection needs ServletContext? Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • 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">
    <value><![CDATA[
    { firstName : length(?) < 30 : 'First name too long' }
    ]]></value>
    </property>
    </bean>

    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?

    Thanks

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

    <dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-web</artifactId>
    <version>3.2.5.RELEASE</version>
    <optional>true</optional>
    <scope>runtime</scope>
    </dependency>

    and also

    <dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
    </dependency>


    notice the runtime scope for spring-web.

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

    Comment

    Working...
    X