I've embedded spring batch admin in my web application and disabled xsd validation in order to be able to configure some transaction properties (as per http://forum.springsource.org/showth...xsd-validation ).
But disabling xsd validation it seems that some bean initialization suffers from missing default values: the application doesn't start complaining
Steps to reproduce using the spring batch admin sample module:Caused by: java.lang.IllegalArgumentException: Invalid log level ''. The (case-insensitive) supported values are: FATAL,ERROR,WARN,INFO,DEBUG,TRACE
at org.springframework.integration.handler.LoggingHan dler.<init>(LoggingHandler.java:69)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInsta nce(NativeConstructorAccessorImpl.java:39)
at sun.reflect.DelegatingConstructorAccessorImpl.newI nstance(DelegatingConstructorAccessorImpl.java:27)
at java.lang.reflect.Constructor.newInstance(Construc tor.java:513)
at org.springframework.beans.BeanUtils.instantiateCla ss(BeanUtils.java:126)
* modify the web.xml in order to use a custom class to load the application context from xml
* build the app
* deploy and run
where
is a web.xml snippet needed to use a custom class to load the xml with no schema validation andCode:<context-param> <param-name>contextClass</param-name> <param-value>com.acme.NovalidationXmlWebApplicationContext</param-value> </context-param>
is the class that disables xsd validation.Code:package com.acme; import org.springframework.beans.factory.xml.XmlBeanDefinitionReader; import org.springframework.web.context.support.XmlWebApplicationContext; /** * XML application context with no xsd validation. * * @author Davide Cavestro * */ public class NovalidationXmlWebApplicationContext extends XmlWebApplicationContext { public NovalidationXmlWebApplicationContext () { // no-op } protected void initBeanDefinitionReader(XmlBeanDefinitionReader beanDefinitionReader) { beanDefinitionReader.setValidating (false); //the following settings bring to same result: IllegalArgumentException // beanDefinitionReader.setValidationMode (XmlBeanDefinitionReader.VALIDATION_NONE); // beanDefinitionReader.setNamespaceAware (true); } }
What's wrong with my configuration?
The main side effect is that my application cannot disable xsd validation and still embed spring batch admin.


Reply With Quote