运行Spring MVC 5'时遇到错误
在类路径资源[org / springframework / web / servlet / config / annotation / DelegatingWebMvcConfiguration.class]中定义的HandlerAdapter':通过工厂方法实例化Bean失败;嵌套的异常是org.springframework.beans.BeanInstantiationException:无法实例化[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]:工厂方法'requestMappingHandlerAdapter'引发了异常;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建在类路径资源[org / springframework / web / servlet / config / annotation / DelegatingWebMvcConfiguration.class]中定义的名称为'mvcValidator'的bean时出错:调用init方法失败;嵌套的异常是java.lang.AbstractMethodError:org.hibernate.validator.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax / validation / ParameterNameProvider; 警告:[tomcat] [2019-09-16 14:00:32,390] [InitDestroyAnnotationBeanPostProcessor.java {1} :: postProcessBeforeDestruction {1}:163]在名称为'monitorService'的bean上调用destroy方法失败:java.lang。空指针异常 警告:[tomcat] [2019-09-16 14:00:34,167] [InitDestroyAnnotationBeanPostProcessor.java {1} :: postProcessBeforeDestruction {1}:163]在名称为'msBatchClientImpl'的bean上调用destroy方法失败:java.lang。反映.UndeclaredThrowableException 错误:[tomcat] [2019-09-16 14:00:42,148] [ContextLoader.java {1} :: initWebApplicationContext {1}:316]上下文初始化失败 org.springframework.beans.factory.BeanCreationException:在类路径资源[org / springframework / web / servlet / config / annotation / DelegatingWebMvcConfiguration.class]中创建名称为'requestMappingHandlerAdapter'的bean时出错:通过工厂方法实例化Bean失败;嵌套的异常是org.springframework.beans.BeanInstantiationException:无法实例化[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]:工厂方法'requestMappingHandlerAdapter'引发了异常;嵌套的异常是org.springframework.beans.factory.BeanCreationException:创建在类路径资源[org / springframework / web / servlet / config / annotation / DelegatingWebMvcConfiguration.class]中定义的名称为'mvcValidator'的bean时出错:调用init方法失败;嵌套的异常是java.lang.AbstractMethodError:org.hibernate.validator.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax / validation / ParameterNameProvider; 在org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587) 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1250)处 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1099) 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:541)处 在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:501) 在org.springframework.beans.factory.support.AbstractBeanFactory.lambda $ doGetBean $ 0(AbstractBeanFactory.java:317) 在org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:228) 在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:315) 在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:199) 在org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java) 在org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:760) 在org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:869) 在org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) 在org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:409) 在org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:291) 在org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:103) 在org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4850) 在org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5313) 在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145) 在org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:753) 在org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:729) 在org.apache.catalina.core.StandardHost.addChild(StandardHost.java:717) 在org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:620) 在org.apache.catalina.startup.HostConfig $ DeployDescriptor.run(HostConfig.java:1832) 在java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511) 在java.util.concurrent.FutureTask.run(FutureTask.java:266) 在java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149) 在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:624) 在java.lang.Thread.run(Thread.java:748)
我的依赖版本为:
<java-version>1.8</java-version>
<spring.version>5.0.5.RELEASE</spring.version>
<spring.security.version>5.1.6.RELEASE</spring.security.version>
<spring.ws.version>3.0.7.RELEASE</spring.ws.version>
<spring.data.jpa.version>2.1.10.RELEASE</spring.data.jpa.version>
<spring.data.mongodb.version>2.1.10.RELEASE</spring.data.mongodb.version>
<mongo-java-driver.version>3.11.0</mongo-java-driver.version>
<aspectj-version>1.9.4</aspectj-version>
<slf4j.version>1.7.28</slf4j.version>
<log4j.version>1.2.17</log4j.version>
<jackson.version>2.9.9</jackson.version>
<javax.servlet.version>4.0.1</javax.servlet.version>
<commons-io-version>2.6</commons-io-version>
<com.google.guava-version>21.0</com.google.guava-version>
<junit.version>4.12</junit.version>
<jodatime.version>2.10.3</jodatime.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<lombok.version>1.18.8</lombok.version>
<postgresql.version>42.2.2</postgresql.version>
<maven-dependency-plugin.version>3.1.1</maven-dependency-plugin.version>
<maven-war-plugin.version>3.2.3</maven-war-plugin.version>
<maven-jar-plugin.version>3.1.2</maven-jar-plugin.version>
<maven-clean-plugin.version>2.5</maven-clean-plugin.version>
<hibernate.version>5.2.16.Final</hibernate.version>
<hibernate-jpa-2.1-api.version>1.0.2.Final</hibernate-jpa-2.1-api.version>
<validation-api.version>2.0.1.Final</validation-api.version>
<hibernate-validator.version>6.0.10.Final</hibernate-validator.version>
<javax.servlet-api.version>4.0.1</javax.servlet-api.version>
你能帮忙吗?
答案 0 :(得分:0)
我没有看到任何代码。您如何实例化“ mvcValidator”?请关注下面的消息,我认为您的代码中有问题,调用“ mvcValidator” bean的构造函数时失败。
org.hibernate.validator.engine.ConfigurationImpl.getDefaultParameterNameProvider()Ljavax / validation / ParameterNameProvider;在org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:587)在
答案 1 :(得分:0)
我找到了一个非常酷的Intellij插件,名为:maven helper。 我在Pom.xml上运行了依赖项分析器,发现在我的一个子模块中使用了较旧的休眠验证器版本。