When you build the JUnit environment, when you test the controller, you are prompted "caused By:javax.validation.ValidationException:Unable to instantiate Configuration.”
2014-11-3 18:06:46 org.springframework.context.support.FileSystemXmlApplicationContext Preparerefresh Info: refreshing org.[email protected]f81843:startup date [Mon Nov 18:06:46 CST 2014]; Root of context Hierarchy2014-11-3 18:06:46 Org.springframework.beans.factory.xml.XmlBeanDefinitionReader Loadbeandefinitions info: Loading XML bean definitions from file [D:\Workspaces\SpringMVCDemo\WebContent\WEB-INF\ Springmvc-servlet.xml]2014-11-3 18:06:46 Org.springframework.context.annotation.ClassPathBeanDefinitionScanner Registerdefaultfilters info: JSR-250 ' javax.annotation.ManagedBean ' found and supported for component Scanning2014-11-3 18:06:46 Org.springframework.context.annotation.ClassPathBeanDefinitionScanner registerdefaultfilters Info: JSR-330 ' Javax.inject.Named ' annotation found and supported for component Scanning2014-11-3 18:06:46 Org.springframework.context.annotation.ClassPathBeanDefinitionScanner registerdefaultfilters Info: JSR-250 ' Javax.annotation.ManagedBean ' found and supportedFor component Scanning2014-11-3 18:06:46 Org.springframework.context.annotation.ClassPathBeanDefinitionScanner Registerdefaultfilters info: JSR-330 ' javax.inject.Named ' annotation found and supported for component Scanning2014-11-3 18 : 06:46 org.springframework.context.annotation.ClassPathBeanDefinitionScanner registerdefaultfilters info: JSR-250 ' Javax.annotation.ManagedBean ' found and supported for component Scanning2014-11-3 18:06:46 Org.springframework.context.annotation.ClassPathBeanDefinitionScanner registerdefaultfilters Info: JSR-330 ' Javax.inject.Named ' annotation found and supported for component Scanning2014-11-3 18:06:46 Org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor<Init>Info: JSR-330 ' javax.inject.Inject ' annotation found and supported for Autowiring2014-11-3 18:06:46 Org.springframework.beans.factory.support.DefaultListableBeanFactory preinstantiatesingletons Information: pre-instantiating singletons in org.s[email protected]dda25b:defining beans [ Org.springframework.context.annotation.internalConfigurationAnnotationProcessor, Org.springframework.context.annotation.internalAutowiredAnnotationProcessor, Org.springframework.context.annotation.internalRequiredAnnotationProcessor, Org.springframework.context.annotation.internalcommonannotationprocessor,basecontroller,testcontroller, Mvccontentnegotiationmanager, Org.springframework.web.servlet.mvc.method.annotation.requestmappinghandlermapping#0, Org.springframework.format.support.formattingconversionservicefactorybean#0, Org.springframework.validation.beanvalidation.localvalidatorfactorybean#0, Org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter#0, Org.springframework.web.servlet.handler. Mappedinterceptor#0,org.springframework.web.servlet.mvc.method.annotation.exceptionhandlerexceptionresolver#0, Org.springframework.web.servlet.mvc.annotation.responsestatusexceptionresolver#0, Org.springframework.web.servlet.mvc.support.defaulthandlerexceptionresolver#0, Org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping, Org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter, Org.springframework.web.servlet.mvc.simplecontrollerhandleradapter,viewresolver, Org.springframework.web.servlet.resource.defaultservlethttprequesthandler#0, Org.springframework.web.servlet.handler.simpleurlhandlermapping#0, Org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; Root of Factory Hierarchyerror Statuslogger Log4j2 could not find a logging implementation. Please add Log4j-core to the classpath. Using Simplelogger to log to the console ... 2014-11-3 18:06:46 org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping RegisterhAndlermethod Info: Mapped "{[/transfer],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto Public Org.springframework.web.servlet.ModelAndView Com.candy.web.test.TestController.referLogin () 2014-11-3 18:06:46 org.hibernate.validator.util.Version<Clinit>Info: Hibernate Validator bean-validator-3.0-jboss-4.0.22014-11-3 18:06:46 Org.springframework.beans.factory.support.DefaultListableBeanFactory destroysingletons Info: destroying singletons in org.s[email protected]dda25b:defining Beans [ Org.springframework.context.annotation.internalConfigurationAnnotationProcessor, Org.springframework.context.annotation.internalAutowiredAnnotationProcessor, Org.springframework.context.annotation.internalRequiredAnnotationProcessor, Org.springframework.context.annotation.internalcommonannotationprocessor,basecontroller,testcontroller, Mvccontentnegotiationmanager, Org.springframework.web.servlet.mvc.method.annotation.requestmappinghandlermapping#0, Org.springframework.format.support.formattingconversionservicefactorybean#0, Org.springframework.validation.beanvalidation.localvalidatorfactorybean#0, Org.springframework.web.servlet.mvc.method.annotation.requestmappinghandleradapter#0, Org.springframework.web.servlet.handler.mappedinterceptor#0,org.springframeworK.web.servlet.mvc.method.annotation.exceptionhandlerexceptionresolver#0, Org.springframework.web.servlet.mvc.annotation.responsestatusexceptionresolver#0, Org.springframework.web.servlet.mvc.support.defaulthandlerexceptionresolver#0, Org.springframework.web.servlet.handler.BeanNameUrlHandlerMapping, Org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter, Org.springframework.web.servlet.mvc.simplecontrollerhandleradapter,viewresolver, Org.springframework.web.servlet.resource.defaultservlethttprequesthandler#0, Org.springframework.web.servlet.handler.simpleurlhandlermapping#0, Org.springframework.context.annotation.ConfigurationClassPostProcessor.importAwareProcessor]; Root of Factory Hierarchyjava.lang.ExceptionInInitializerErrorcaused By:org.springframework.beans.factory.BeanCreationException:Error creating Bean with Name ' org.springframework.validation.beanvalidation.localvalidatorfactorybean#0 ': Invocation of Init method Failed Nested exception is javax.validation.ValidationException:Unable to instantiate Configuration. At Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1482) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean ( abstractautowirecapablebeanfactory.java:521) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean ( abstractautowirecapablebeanfactory.java:458) at org.springframework.beans.factory.support.abstractbeanfactory$1. GetObject (abstractbeanfactory.java:295) at Org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton ( defaultsingletonbeanregistry.java:223) at Org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean (abstractbeanfactory.java:292) at Org.springframework.beans.factory.support.AbstractBeanFactory.getBean (abstractbeanfactory.java:194) at Org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons ( Defaultlistablebeanfactory.java:628) at Org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization (abstractapplicationcontext.java:932) at Org.springframework.context.support.AbstractApplicationContext.refresh ( abstractapplicationcontext.java:479) at Org.springframework.context.support.FileSystemXmlApplicationContext.<Init>(filesystemxmlapplicationcontext.java:140) at Org.springframework.context.support.FileSystemXmlApplicationContext.<Init>(filesystemxmlapplicationcontext.java:84) at Com.candy.web.BaseController.<Clinit>(basecontroller.java:25)caused By:javax.validation.ValidationException:Unable to instantiate Configuration.At Javax.validation.validation$genericbootstrapimpl.configure (validation.java:272) at Org.springframework.validation.beanvalidation.LocalValidatorFactoryBean.afterPropertiesSet ( localvalidatorfactorybean.java:188) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods ( abstractautowirecapablebeanfactory.java:1541) at Org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean ( abstractautowirecapablebeanfactory.java:1479) ... Morecaused By:java.lang.NullPointerExceptionAt Java.util.ResourceBundle.getBundle (resourcebundle.java:950) at Org.hibernate.validator.engine.ResourceBundleMessageInterpolator.loadBundle ( resourcebundlemessageinterpolator.java:202) at Org.hibernate.validator.engine.ResourceBundleMessageInterpolator.getFileBasedResourceBundle ( resourcebundlemessageinterpolator.java:182) at Org.hibernate.validator.engine.ResourceBundleMessageInterpolator.<Init>(resourcebundlemessageinterpolator.java:81) at Org.hibernate.validator.engine.ResourceBundleMessageInterpolator.<Init>(resourcebundlemessageinterpolator.java:73) at Org.hibernate.validator.engine.ConfigurationImpl.<Init>(configurationimpl.java:57) at Org.hibernate.validator.HibernateValidator.createGenericConfiguration ( hibernatevalidator.java:43) at Javax.validation.validation$genericbootstrapimpl.configure (Validation.java:269) ... Moreexception in thread "main"
Solution: Remove the jar package that comes with JavaEE6: Bean-validator.jar