本文介绍了java.lang.NoSuchMethodError:org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver:method< init>()V not found的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发 Spring + MVC + RestEasy 示例。我成功地开发了代码,但是我看到下面的错误。它看起来像依赖性不匹配的问题。我已经很费力地解决这个问题,但无法修复它。我在这里上传了源代码:

  org.springframework.beans.factory.BeanCreationException:创建错误名为'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter'的bean:调用init方法失败;嵌套异常是java.lang.NoSuchMethodError:org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver:method< init>()V not found 
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean( AbstractAutowireCapableBeanFactory.java:1582)美元,org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545 b $ b)
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean( AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton (DefaultSingletonBeanRegistry.java:230)
在org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
在org.springframe在org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons work.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
(DefaultListableBeanFactory.java:778)
。在组织。 springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
at org.springframework.web。 servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:666)
位于org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:632)
位于org.springframework.web.servlet.FrameworkServlet。在org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:551)上创建Web应用程序上下文(FrameworkServlet.java:680)
org.springframework.w上的
eb.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:492)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init( GenericServlet.java:158)在org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238

在org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)$ b在org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5337)
$ b在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
。在组织.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1407)
在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1397)
是java .util.concurrent.FutureTask $ S (FutureTask.java:334)$ java.util.concurrent.FutureTask.run(FutureTask.java:166)
java.util.concurrent.ThreadPoolExecutor.runWorker
(ThreadPoolExecutor.java: 1145)
在java.util.concurrent.ThreadPoolExecutor $ Worker.run(ThreadPoolExecutor.java:615)$ b $在java.lang.Thread.run(Thread.java:724)
导致:java.lang.NoSuchMethodError:org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver:method< init>()V not found
at org.springframework.web.servlet.mvc.method.annotation.PathVariableMethodArgumentResolver。 < init>(PathVariableMethodArgumentResolver.java:68)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.getDefaultArgumentResolvers(RequestMappingHandlerAdapter.java:591)
at org.springframework.web .servlet.mvc.method.annotation.RequestMappingHandlerAdapter.afterPropertiesSet(RequestMappingHandlerAdapter.java:521)
at org.springframew ork.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1641)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
... 29更

2016年12月23日下午6点25分19秒org.apache.catalina.core.StandardContext loadOnStartup
重度:Servlet的[用SpringMVC-冬眠-RestEasy的]在web应用[/ RestEasy的-spring-MVC-休眠]扔负荷()例外
java.lang.NoSuchMethodError:org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver:方法< INIT>()V没有找到
。在有机.springframework.web.servlet.mvc.method.annotation.PathVariableMethodArgumentResolver。< init>(PathVariableMethodArgumentResolver.java:68)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.getDefaultArgumentResolvers(RequestMappingHandlerAdapter .java:591)
at org。 springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.afterPropertiesSet(RequestMappingHandlerAdapter.java:521)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1641)
在org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)中
$ b $ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.java:545 b at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractBeanFactory $ 1.getObject(AbstractBeanFactory.java:306)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
at org.s pringframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
在org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
。在组织。 springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:778)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
at org.springframework。 context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
位于org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:666)
位于org.springframework.web.servlet。在org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:680)上的
$ or $ $ b $ org.springf ramework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:551)
处org.springframework.web org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:492)
。 servlet.HttpServletBean.init(HttpServletBean.java:136)
在javax.servlet.GenericServlet.init(GenericServlet.java:158)
在org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper。
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038)在org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)

在org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5337)
在org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
。在org.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1407)
。在Ô rg.apache.catalina.core.ContainerBase $ StartChild.call(ContainerBase.java:1397)
at java.util.concurrent.FutureTask $ Sync.innerRun(FutureTask.java:334)
at java。 util.concurrent.FutureTask.run(FutureTask.java:166)$ java.util.concurrent.ThreadPoolExecutor.runWorker中的
(ThreadPoolExecutor.java:1145)$ java.util.concurrent.ThreadPoolExecutor $ $中的
。运行(ThreadPoolExecutor.java:615)
在java.lang.Thread.run(Thread.java:724)

pom.xml

 < modelVersion> 4.0.0< / modelVersion> ; 
< groupId> in.bench.resources< / groupId>
< artifactId> RestEasy-Spring-MVC-Hibernate< / artifactId>
< version> 1.0< / version>
<包装>战争< / packaging>
< name> RestEasy-Spring-MVC-Hibernate< / name>
< description> RestEasy:与Spring-MVC-Framework和Hibernate ORM集成< / description>


<属性>
< resteasy.version> 3.0.8.Final< /resteasy.version>
< resteasy.scope>编译< /resteasy.scope> <! - compile(Tomcat)/ provided(JBoss) - >
< spring.version> 4.2.8.RELEASE< /spring.version> <! - 4.x直接与RestEasy无关 - >
< hibernate.version> 4.3.11.Final< /hibernate.version>
< mysql.version> 5.1.32< /mysql.version>
< validation-api.version> 1.1.0.Final< /validation-api.version>
< hibernate-validator.version> 5.1.3.Final< /hibernate-validator.version>

< servlet.version> 3.1.0< /servlet.version>
< jstl.version> 1.2< /jstl.version>
< compileSource> 1.7< / compileSource>
< maven.compiler.target> 1.7< /maven.compiler.target>
< maven.compiler.source> 1.7< /maven.compiler.source>
< project.build.sourceEncoding> UTF-8< /project.build.sourceEncoding>
< logback.version> 1.1.3< /logback.version>
< jcl.slf4j.version> 1.7.12< /jcl.slf4j.version>
< / properties>



<依赖关系>
< dependency>
< groupId> org.jboss.resteasy< / groupId>
< artifactId> resteasy-jaxrs< / artifactId>
< version> $ {resteasy.version}< / version>
< scope> $ {resteasy.scope}< / scope>
< /依赖关系>

< dependency>
< groupId> org.jboss.resteasy< / groupId>
< artifactId> resteasy-servlet-initializer< / artifactId>
< version> $ {resteasy.version}< / version>
< scope> $ {resteasy.scope}< / scope>
< /依赖关系>

< dependency>
< groupId> org.jboss.resteasy< / groupId>
< artifactId> resteasy-jaxb-provider< / artifactId>
< version> $ {resteasy.version}< / version>
< scope> $ {resteasy.scope}< / scope>
< /依赖关系>

< dependency>
< groupId> org.jboss.resteasy< / groupId>
< artifactId> resteasy-jackson-provider< / artifactId>
< version> $ {resteasy.version}< / version>
< scope> $ {resteasy.scope}< / scope>
< /依赖关系>

< dependency>
< groupId> org.jboss.resteasy< / groupId>
< artifactId> resteasy-client< / artifactId>
< version> $ {resteasy.version}< / version>
< scope> $ {resteasy.scope}< / scope>
< /依赖关系>

< dependency>
< groupId> org.jboss.resteasy< / groupId>
< artifactId> resteasy-spring< / artifactId>
< version> $ {resteasy.version}< / version>
< /依赖关系>

< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-webmvc< / artifactId>
< version> $ {spring.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.springframework< / groupId>
< artifactId> spring-tx< / artifactId>
< version> $ {spring.version}< / version>
< /依赖关系>

< dependency>
< groupId> org.springframework.data< / groupId>
< artifactId> spring-data-jpa< / artifactId>
< version> 1.10.5.RELEASE< / version>
< /依赖关系>


< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-entitymanager< / artifactId>
< version> $ {hibernate.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-core< / artifactId>
< version> $ {hibernate.version}< / version>
< /依赖关系>


< dependency>
< groupId> javax.validation< / groupId>
< artifactId> validation-api< / artifactId>
< version> $ {validation-api.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-validator< / artifactId>
< version> $ {hibernate-validator.version}< / version>
< /依赖关系>
< dependency>
< groupId> org.hibernate< / groupId>
< artifactId> hibernate-ehcache< / artifactId>
< version> $ {hibernate.version}< / version>
< /依赖关系>

< dependency>
< groupId> cglib< / groupId>
< artifactId> cglib< / artifactId>
< version> 3.2.4< / version>
< /依赖关系>

<! - MySql-Connector - >
< dependency>
< groupId> mysql< / groupId>
< artifactId> mysql-connector-java< / artifactId>
< version> $ {mysql.version}< / version>
< /依赖关系>

< dependency>
< groupId> javax.servlet< / groupId>
< artifactId> javax.servlet-api< / artifactId>
< version> $ {servlet.version}< / version>
< /依赖关系>

< dependency>
< groupId> jstl< / groupId>
< artifactId> jstl< / artifactId>
< version> $ {jstl.version}< / version>
< /依赖关系>

< dependency>
< groupId> org.slf4j< / groupId>
< artifactId> jcl-over-slf4j< / artifactId>
< version> $ {jcl.slf4j.version}< / version>
< /依赖关系>

< dependency>
< groupId> ch.qos.logback< / groupId>
< artifactId> logback-classic< / artifactId>
< version> $ {logback.version}< / version>
< /依赖关系>
< /依赖关系>

< repositories>
< repository>
< id> jboss< / id>
< url> http://repository.jboss.org/maven2< / url>
< / repository>
< / repositories>

< build>
< finalName> RestEasy-Spring-MVC-Hibernate< / finalName>

< plugins>
< plugin>
< groupId> org.apache.maven.plugins< / groupId>
< artifactId> maven-compiler-plugin< / artifactId>
< version> 3.1< / version>
<配置>
< source> 1.7< / source>
< target> 1.7< / target>
< / configuration>
< / plugin>

< plugin>
< groupId> org.codehaus.mojo< / groupId>
< artifactId> jaxb2-maven-plugin< / artifactId>
< version> 1.6< / version>
<执行次数>
<执行>
<目标>
< goal> xjc< / goal><! - xjc / generate - >
< /目标>
<配置>
< outputDirectory> $ {basedir} / generated / java / source< / outputDirectory>
< schemaDirectory> $ {basedir} / src / main / resources / com / resteasy / series / spring / mvc / hibernate / service / entities< / schemaDirectory>
< schemaFiles> *。xsd< / schemaFiles>
< schemaLanguage> XMLSCHEMA< / schemaLanguage>
< extension> true< / extension>
< args>
< arg> -XtoString< / arg>
< / args>
< plugins>
< plugin>
< groupId> org.jvnet.jaxb2_commons< / groupId>
< artifactId> jaxb2-basics< / artifactId>
< version> 0.6.4< / version>
< / plugin>
< / plugins>
< / configuration>
< /执行>
< /执行次数>
< / plugin>
< / plugins>
< / build>

springmvc-hibernate-resteasy-servlet.xml

 <?xml version =1.0encoding =UTF-8?> 
< beans xmlns =http://www.springframework.org/schema/beans
xmlns:xsi =http://www.w3.org/2001/XMLSchema-instance
xmlns:context =http://www.springframework.org/schema/context
xmlns:tx =http://www.springframework.org/schema/tx
xmlns :mvc =http://www.springframework.org/schema/mvc
xmlns:jpa =http://www.springframework.org/schema/data/jpa
xsi:schemaLocation =http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
http://www.springframework.org/schema/ bean http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema /data/jpa/spring-jpa.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd\">

< import resource =classpath:springmvc-resteasy.xml/>

< context:property-placeholder location =classpath:database.properties/>

< context:annotation-config />

< jpa:repositories base-package =com.resteasy.series.spring.mvc.hibernate.repository/>

< mvc:annotation-driven />

< context:component-scan base-package =com.resteasy.series.spring.mvc.hibernate。*/>

< tx:注解驱动的事务管理器=transactionManager/>

<! - 交易管理器 - >
< bean id =transactionManagerclass =org.springframework.orm.jpa.JpaTransactionManager>
< property name =entityManagerFactoryref =entityManagerFactory/>
< / bean>


< bean id =jpaVendorAdapterclass =org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter>
< property name =showSqlvalue =true/>
< property name =generateDdlvalue =true/>
< property name =databasevalue =MYSQL/>
< / bean>

< bean id =entityManagerFactoryclass =org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean>
< property name =dataSourceref =dataSource/>
< property name =jpaVendorAdapterref =jpaVendorAdapter/>
< property name =packagesToScanvalue =com.resteasy.series.spring.mvc.hibernate.model/>

< property name =jpaProperties>
<道具>
< prop key =hibernate.hbm2ddl.auto> $ {mysql.hibernate.hbm2ddl.auto}< / prop>
< prop key =hibernate.dialect> $ {mysql.hibernate.dialect}< / prop>
< /道具>
< / property>

< / bean>

< bean id =dataSourceclass =org.springframework.jdbc.datasource.DriverManagerDataSource>
< property name =driverClassNamevalue =$ {mysql.driverClassName}/>
< property name =urlvalue =$ {mysql.url}/>
< property name =usernamevalue =$ {mysql.username}/>
< property name =passwordvalue =$ {mysql.password}/>
< / bean>

<! - 视图解析器 - >
< bean id =viewResolverclass =org.springframework.web.servlet.view.InternalResourceViewResolver>
< property name =viewClassvalue =org.springframework.web.servlet.view.JstlView/>
< property name =prefixvalue =/ WEB-INF / jsp //>
< property name =suffixvalue =。jsp/>
< / bean>
< / beans>

如果您需要其他详细信息,请告诉我。我真的需要帮助。在使用resteasy + spring时,我认为这是非常典型的问题。

依赖树:

  [信息] --- maven-dependency-plugin:2.1:tree(default-cli)@ RestEasy-Spring-MVC-Hibernate --- 
[INFO] in.bench.resources:RestEasy-Spring-MVC-Hibernate:war :1.0
[INFO] + - org.jboss.resteasy:resteasy-jaxrs:jar:3.0.8.Final:compile
[INFO] | + - org.jboss.resteasy:jaxrs-api:jar:3.0.8.Final:编译
[INFO] | + - org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] | + - javax.activation:activation:jar:1.1:编译
[INFO] | + - org.apache.httpcomponents:httpclient:jar:4.2.1:compile
[INFO] | | + - org.apache.httpcomponents:httpcore:jar:4.2.1:compile
[INFO] | | + - commons-logging:commons-logging:jar:1.1.1:编译
[INFO] | | \- commons-codec:commons-codec:jar:1.6:编译
[INFO] | + - commons-io:commons-io:jar:2.1:编译
[INFO] | \- net.jcip:jcip-annotations:jar:1.0:编译
[INFO] + - org.jboss.resteasy:resteasy-servlet-initializer:jar:3.0.8.Final:compile
[INFO] | \- org.jboss.resteasy:async-http-servlet-3.0:jar:3.0.8.Final:编译
[INFO] + - org.jboss.resteasy:resteasy-jaxb-provider:jar:3.0 .8.Final:编译
[INFO] | \- com.sun.xml.bind:jaxb-impl:jar:2.2.7:编译
[INFO] | + - com.sun.xml.bind:jaxb-core:jar:2.2.7:compile
[INFO] | | + - javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] | | \- com.sun.istack:istack-commons-runtime:jar:2.16:compile
[INFO] | \- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.12:compile
[INFO] | \ javax.xml.bind:jsr173_api:jar:1.0:编译
[INFO] + - org.jboss.resteasy:resteasy-jackson-provider:jar:3.0.8.Final:compile
[INFO] | + - org.codehaus.jackson:jackson-core-asl:jar:1.9.12:compile
[INFO] | + - org.codehaus.jackson:jackson-mapper -asl:jar:1.9.12:compile
[INFO] | + - org.codehaus.jackson:jackson-jaxrs:jar:1.9.12:compile
[INFO] | \- org.codehaus.jackson:jackson-xc:jar:1.9.12:compile
[INFO] + - org.jboss.resteasy:resteasy-client:jar:3.0.8.Final:compile
[INFO] + - org.jboss.resteasy:resteasy-spring:jar:3.0.8.Final:编译
[INFO] | \- org.jboss.resteasy:resteasy-jettison-provider:jar:3.0.8.Final:编译
[INFO] | \- org.codehaus.jettison:jettison:jar:1.3.2:编译
[INFO] + - org.springframework:spring-webmvc:jar:4.2.8.RELEASE:compile
[INFO ] | + - org.springframework:spring-beans:jar:4.2.8.RELEASE:compile
[INFO] | + - org.springframework:spring-context:jar:4.2.8.RELEASE:compile
[INFO] | + - org.springframework:spring-core:jar:4.2.8.RELEASE:compile
[INFO] | + - org.springframework:spring-expression:jar:4.2.8.RELEASE:compile
[INFO] | \- org.springframework:spring-web:jar:4.2.8.RELEASE:compile
[INFO] + - org.springframework:spring-tx:jar:4.2.8.RELEASE:compile
[INFO] + - org.springframework.data:spring-data-jpa:jar:1.10.5.RELEASE:compile
[INFO] | + - org.springframework.data:spring-data-commons:jar:1.12.5.RELEASE:compile
[INFO] | + - org.springframework:spring-orm:jar:4.2.8.RELEASE:compile
[INFO] | | \- org.springframework:spring-jdbc:jar:4.2.8.RELEASE:compile
[INFO] | + - org.springframework:spring-aop:jar:4.2.8.RELEASE:compile
[INFO] | | \\ a- aopalliance:aopalliance:jar:1.0:编译
[INFO] | + - org.aspectj:aspectjrt:jar:1.8.9:编译
[INFO] | \- org.slf4j:slf4j-api:jar:1.7.21:编译
[INFO] + - org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile
[INFO ] | + - org.jboss.logging:jboss-logging:jar:3.1.3.GA:编译
[INFO] | + - org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] | + - dom4j:dom4j:jar:1.6.1:编译
[INFO] | | \ -xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] | + - org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] | + - org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] | + - org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] | \- org.javassist:javassist:jar:3.18.1-GA:编译
[INFO] + - org.hibernate:hibernate-core:jar:4.3.11.Final:compile
[INFO ] | + - antlr:antlr:jar:2.7.7:编译
[INFO] | \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] + - javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO ] + - org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] | \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] + - org.hibernate:hibernate-ehcache:jar:4.3.11.Final:compile
[INFO] | \- net.sf.ehcache:ehcache-core:jar:2.4.3:compile
[INFO] + - cglib:cglib:jar:3.2.4:compile
[INFO] | + - org.ow2.asm:asm:jar:5.1:编译
[INFO] | \- org.apache.ant:ant:jar:1.9.6:编译
[INFO] | \- org.apache.ant:ant-launcher:jar:1.9.6:compile
[INFO] + - com.fasterxml.jackson.core:jackson-core:jar:2.8.5:compile
[INFO] + - mysql:mysql-connector-java:jar:5.1.32:compile
[INFO] + - javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] + - jstl:jstl:jar:1.2:编译
[INFO] + - org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] \\ \\ ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO] \ ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] ----------------------------------------------- -------------------------
[信息]建立成功
[信息] --------- -------------------------------------------------- -------------
[信息]总时间:1.697s
[信息]完成时间:周五12月23日18:59:14 IST 2016
[ INFO] Final Memory:12M / 494M
[INFO] ----------------------------------- -------------------------------------


解决方案

我有同样的问题。我的错误是我忘了将@Autowired注解添加到构造函数中。

在我的特殊情况下,我试图配置一个CommandLineRunner,其最终字段是@Service class。


$ b 正确地将@Autowired注释添加到MyCommandLineRunner后,异常消失。


I am developing Spring + MVC + RestEasy example. I was successfully able to developed the code, but I see the below error. It looks like to dependency mismatched issue. I already frusted to solve this issue, but unable to fixed it yet. I uploaded source code here: https://github.com/test512/RestEasy-Spring-MVC-Hibernate

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter': Invocation of init method failed; nested exception is java.lang.NoSuchMethodError: org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver: method <init>()V not found
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1582)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:778)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:666)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:632)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:680)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:551)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:492)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5337)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.NoSuchMethodError: org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver: method <init>()V not found
    at org.springframework.web.servlet.mvc.method.annotation.PathVariableMethodArgumentResolver.<init>(PathVariableMethodArgumentResolver.java:68)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.getDefaultArgumentResolvers(RequestMappingHandlerAdapter.java:591)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.afterPropertiesSet(RequestMappingHandlerAdapter.java:521)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1641)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    ... 29 more

Dec 23, 2016 6:25:19 PM org.apache.catalina.core.StandardContext loadOnStartup
SEVERE: Servlet [springmvc-hibernate-resteasy] in web application [/RestEasy-Spring-MVC-Hibernate] threw load() exception
java.lang.NoSuchMethodError: org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver: method <init>()V not found
    at org.springframework.web.servlet.mvc.method.annotation.PathVariableMethodArgumentResolver.<init>(PathVariableMethodArgumentResolver.java:68)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.getDefaultArgumentResolvers(RequestMappingHandlerAdapter.java:591)
    at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.afterPropertiesSet(RequestMappingHandlerAdapter.java:521)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1641)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1578)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:545)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:778)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:839)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:538)
    at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:666)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:632)
    at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:680)
    at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:551)
    at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:492)
    at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
    at javax.servlet.GenericServlet.init(GenericServlet.java:158)
    at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1238)
    at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1151)
    at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1038)
    at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5027)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5337)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:147)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1407)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1397)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:724)

pom.xml

<modelVersion>4.0.0</modelVersion>
    <groupId>in.bench.resources</groupId>
    <artifactId>RestEasy-Spring-MVC-Hibernate</artifactId>
    <version>1.0</version>
    <packaging>war</packaging>
    <name>RestEasy-Spring-MVC-Hibernate</name>
    <description>RestEasy : Integrating with Spring-MVC-Framework and Hibernate ORM</description>


    <properties>
        <resteasy.version>3.0.8.Final</resteasy.version>
        <resteasy.scope>compile</resteasy.scope>        <!-- compile(Tomcat) / provided(JBoss) -->
        <spring.version>4.2.8.RELEASE</spring.version> <!-- 4.x doesn't work with RestEasy directly -->
        <hibernate.version>4.3.11.Final</hibernate.version>
        <mysql.version>5.1.32</mysql.version>
        <validation-api.version>1.1.0.Final</validation-api.version>
        <hibernate-validator.version>5.1.3.Final</hibernate-validator.version>

        <servlet.version>3.1.0</servlet.version>
        <jstl.version>1.2</jstl.version>
        <compileSource>1.7</compileSource>
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.compiler.source>1.7</maven.compiler.source>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <logback.version>1.1.3</logback.version>
        <jcl.slf4j.version>1.7.12</jcl.slf4j.version>
    </properties>



    <dependencies>
        <!-- RESTEasy JAX RS Implementation -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxrs</artifactId>
            <version>${resteasy.version}</version>
            <scope>${resteasy.scope}</scope>
        </dependency>

        <!-- Resteasy Servlet Container Initializer -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-servlet-initializer</artifactId>
            <version>${resteasy.version}</version>
            <scope>${resteasy.scope}</scope>
        </dependency>

        <!-- Resteasy JAXB Provider -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jaxb-provider</artifactId>
            <version>${resteasy.version}</version>
            <scope>${resteasy.scope}</scope>
        </dependency>

        <!-- Resteasy Jackson Provider -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-jackson-provider</artifactId>
            <version>${resteasy.version}</version>
            <scope>${resteasy.scope}</scope>
        </dependency>

        <!-- RESTEasy JAX RS Client -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-client</artifactId>
            <version>${resteasy.version}</version>
            <scope>${resteasy.scope}</scope>
        </dependency>

        <!-- Resteasy Spring Integration -->
        <dependency>
            <groupId>org.jboss.resteasy</groupId>
            <artifactId>resteasy-spring</artifactId>
            <version>${resteasy.version}</version>
        </dependency>

        <!-- Spring Framework -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${spring.version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-tx</artifactId>
            <version>${spring.version}</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.data</groupId>
            <artifactId>spring-data-jpa</artifactId>
            <version>1.10.5.RELEASE</version>
        </dependency>


        <!-- Hibernate Core -->
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-entitymanager</artifactId>
            <version>${hibernate.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-core</artifactId>
            <version>${hibernate.version}</version>
        </dependency>


        <!-- Validations -->
        <dependency>
            <groupId>javax.validation</groupId>
            <artifactId>validation-api</artifactId>
            <version>${validation-api.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-validator</artifactId>
            <version>${hibernate-validator.version}</version>
        </dependency>
        <dependency>
            <groupId>org.hibernate</groupId>
            <artifactId>hibernate-ehcache</artifactId>
            <version>${hibernate.version}</version>
        </dependency>

        <dependency>
            <groupId>cglib</groupId>
            <artifactId>cglib</artifactId>
            <version>3.2.4</version>
        </dependency>

        <!-- MySql-Connector -->
        <dependency>
            <groupId>mysql</groupId>
            <artifactId>mysql-connector-java</artifactId>
            <version>${mysql.version}</version>
        </dependency>

        <!-- servlet-3.1.0 -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>javax.servlet-api</artifactId>
            <version>${servlet.version}</version>
        </dependency>

        <!-- JSTL for JSP pages -->
        <dependency>
            <groupId>jstl</groupId>
            <artifactId>jstl</artifactId>
            <version>${jstl.version}</version>
        </dependency>

        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>jcl-over-slf4j</artifactId>
            <version>${jcl.slf4j.version}</version>
        </dependency>

        <!-- 3. logback -->
        <dependency>
            <groupId>ch.qos.logback</groupId>
            <artifactId>logback-classic</artifactId>
            <version>${logback.version}</version>
        </dependency>
    </dependencies>

    <repositories>
        <repository>
            <id>jboss</id>
            <url>http://repository.jboss.org/maven2</url>
        </repository>
    </repositories>

    <build>
        <finalName>RestEasy-Spring-MVC-Hibernate</finalName>

        <!-- maven compiler plugin -->
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>

            <!-- JAXB plugin to generate-sources from XSD -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>jaxb2-maven-plugin</artifactId>
                <version>1.6</version>
                <executions>
                    <execution>
                        <goals>
                            <goal>xjc</goal><!-- xjc/generate -->
                        </goals>
                        <configuration>
                            <outputDirectory>${basedir}/generated/java/source</outputDirectory>
                            <schemaDirectory>${basedir}/src/main/resources/com/resteasy/series/spring/mvc/hibernate/service/entities</schemaDirectory>
                            <schemaFiles>*.xsd</schemaFiles>
                            <schemaLanguage>XMLSCHEMA</schemaLanguage>
                            <extension>true</extension>
                            <args>
                                <arg>-XtoString</arg>
                            </args>
                            <plugins>
                                <plugin>
                                    <groupId>org.jvnet.jaxb2_commons</groupId>
                                    <artifactId>jaxb2-basics</artifactId>
                                    <version>0.6.4</version>
                                </plugin>
                            </plugins>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>

springmvc-hibernate-resteasy-servlet.xml

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xmlns:context="http://www.springframework.org/schema/context"
    xmlns:tx="http://www.springframework.org/schema/tx"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:jpa="http://www.springframework.org/schema/data/jpa"
    xsi:schemaLocation="http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">

    <!-- Import basic SpringMVC Resteasy integration -->
    <import resource="classpath:springmvc-resteasy.xml" />

    <context:property-placeholder location="classpath:database.properties" />

    <!-- to activate annotations in beans already registered in the ApplicationContext -->
    <context:annotation-config />

    <jpa:repositories base-package="com.resteasy.series.spring.mvc.hibernate.repository" />

    <!-- to activate MVC annotation -->
    <mvc:annotation-driven />

    <!-- scans packages to find and register beans within the ApplicationContext -->
    <context:component-scan base-package="com.resteasy.series.spring.mvc.hibernate.*" />

    <!-- turn on spring transaction annotation -->
    <tx:annotation-driven transaction-manager="transactionManager" />

    <!-- Transaction Manager -->
    <bean id="transactionManager"  class="org.springframework.orm.jpa.JpaTransactionManager">
        <property name="entityManagerFactory" ref="entityManagerFactory" />
    </bean>


    <bean id="jpaVendorAdapter" class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter">
        <property name="showSql" value="true"/>
        <property name="generateDdl" value="true"/>
        <property name="database" value="MYSQL"/>
    </bean>

    <!-- Session Factory -->
    <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
        <property name="dataSource" ref="dataSource" />
        <property name="jpaVendorAdapter" ref="jpaVendorAdapter"/>
        <property name="packagesToScan" value="com.resteasy.series.spring.mvc.hibernate.model"/>

        <property name="jpaProperties">
            <props>
                <prop key="hibernate.hbm2ddl.auto">${mysql.hibernate.hbm2ddl.auto}</prop>
                <prop key="hibernate.dialect">${mysql.hibernate.dialect}</prop>
            </props>
        </property>

    </bean>

    <!-- dataSource configuration -->
    <bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" value="${mysql.driverClassName}" />
        <property name="url" value="${mysql.url}" />
        <property name="username" value="${mysql.username}" />
        <property name="password" value="${mysql.password}" />
    </bean>

    <!-- view resolver -->
    <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
        <property name="viewClass" value="org.springframework.web.servlet.view.JstlView" />
        <property name="prefix" value="/WEB-INF/jsp/" />
        <property name="suffix" value=".jsp" />
    </bean>
</beans>

Please let me know if you need any other details. I really need help. I think this is very typical issue when working with resteasy + spring. Isn't it ?

Dependency Tree:

[INFO] --- maven-dependency-plugin:2.1:tree (default-cli) @ RestEasy-Spring-MVC-Hibernate ---
[INFO] in.bench.resources:RestEasy-Spring-MVC-Hibernate:war:1.0
[INFO] +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.8.Final:compile
[INFO] |  +- org.jboss.resteasy:jaxrs-api:jar:3.0.8.Final:compile
[INFO] |  +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.1.Final:compile
[INFO] |  +- javax.activation:activation:jar:1.1:compile
[INFO] |  +- org.apache.httpcomponents:httpclient:jar:4.2.1:compile
[INFO] |  |  +- org.apache.httpcomponents:httpcore:jar:4.2.1:compile
[INFO] |  |  +- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] |  |  \- commons-codec:commons-codec:jar:1.6:compile
[INFO] |  +- commons-io:commons-io:jar:2.1:compile
[INFO] |  \- net.jcip:jcip-annotations:jar:1.0:compile
[INFO] +- org.jboss.resteasy:resteasy-servlet-initializer:jar:3.0.8.Final:compile
[INFO] |  \- org.jboss.resteasy:async-http-servlet-3.0:jar:3.0.8.Final:compile
[INFO] +- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.0.8.Final:compile
[INFO] |  \- com.sun.xml.bind:jaxb-impl:jar:2.2.7:compile
[INFO] |     +- com.sun.xml.bind:jaxb-core:jar:2.2.7:compile
[INFO] |     |  +- javax.xml.bind:jaxb-api:jar:2.2.7:compile
[INFO] |     |  \- com.sun.istack:istack-commons-runtime:jar:2.16:compile
[INFO] |     \- com.sun.xml.fastinfoset:FastInfoset:jar:1.2.12:compile
[INFO] |        \- javax.xml.bind:jsr173_api:jar:1.0:compile
[INFO] +- org.jboss.resteasy:resteasy-jackson-provider:jar:3.0.8.Final:compile
[INFO] |  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.12:compile
[INFO] |  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.12:compile
[INFO] |  +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.12:compile
[INFO] |  \- org.codehaus.jackson:jackson-xc:jar:1.9.12:compile
[INFO] +- org.jboss.resteasy:resteasy-client:jar:3.0.8.Final:compile
[INFO] +- org.jboss.resteasy:resteasy-spring:jar:3.0.8.Final:compile
[INFO] |  \- org.jboss.resteasy:resteasy-jettison-provider:jar:3.0.8.Final:compile
[INFO] |     \- org.codehaus.jettison:jettison:jar:1.3.2:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.2.8.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.2.8.RELEASE:compile
[INFO] |  +- org.springframework:spring-context:jar:4.2.8.RELEASE:compile
[INFO] |  +- org.springframework:spring-core:jar:4.2.8.RELEASE:compile
[INFO] |  +- org.springframework:spring-expression:jar:4.2.8.RELEASE:compile
[INFO] |  \- org.springframework:spring-web:jar:4.2.8.RELEASE:compile
[INFO] +- org.springframework:spring-tx:jar:4.2.8.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-jpa:jar:1.10.5.RELEASE:compile
[INFO] |  +- org.springframework.data:spring-data-commons:jar:1.12.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-orm:jar:4.2.8.RELEASE:compile
[INFO] |  |  \- org.springframework:spring-jdbc:jar:4.2.8.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.2.8.RELEASE:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.aspectj:aspectjrt:jar:1.8.9:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.7.21:compile
[INFO] +- org.hibernate:hibernate-entitymanager:jar:4.3.11.Final:compile
[INFO] |  +- org.jboss.logging:jboss-logging:jar:3.1.3.GA:compile
[INFO] |  +- org.jboss.logging:jboss-logging-annotations:jar:1.2.0.Beta1:compile
[INFO] |  +- dom4j:dom4j:jar:1.6.1:compile
[INFO] |  |  \- xml-apis:xml-apis:jar:1.0.b2:compile
[INFO] |  +- org.hibernate.common:hibernate-commons-annotations:jar:4.0.5.Final:compile
[INFO] |  +- org.hibernate.javax.persistence:hibernate-jpa-2.1-api:jar:1.0.0.Final:compile
[INFO] |  +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.0.0.Final:compile
[INFO] |  \- org.javassist:javassist:jar:3.18.1-GA:compile
[INFO] +- org.hibernate:hibernate-core:jar:4.3.11.Final:compile
[INFO] |  +- antlr:antlr:jar:2.7.7:compile
[INFO] |  \- org.jboss:jandex:jar:1.1.0.Final:compile
[INFO] +- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] +- org.hibernate:hibernate-validator:jar:5.1.3.Final:compile
[INFO] |  \- com.fasterxml:classmate:jar:1.0.0:compile
[INFO] +- org.hibernate:hibernate-ehcache:jar:4.3.11.Final:compile
[INFO] |  \- net.sf.ehcache:ehcache-core:jar:2.4.3:compile
[INFO] +- cglib:cglib:jar:3.2.4:compile
[INFO] |  +- org.ow2.asm:asm:jar:5.1:compile
[INFO] |  \- org.apache.ant:ant:jar:1.9.6:compile
[INFO] |     \- org.apache.ant:ant-launcher:jar:1.9.6:compile
[INFO] +- com.fasterxml.jackson.core:jackson-core:jar:2.8.5:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.32:compile
[INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile
[INFO] +- jstl:jstl:jar:1.2:compile
[INFO] +- org.slf4j:jcl-over-slf4j:jar:1.7.12:compile
[INFO] \- ch.qos.logback:logback-classic:jar:1.1.3:compile
[INFO]    \- ch.qos.logback:logback-core:jar:1.1.3:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.697s
[INFO] Finished at: Fri Dec 23 18:59:14 IST 2016
[INFO] Final Memory: 12M/494M
[INFO] ------------------------------------------------------------------------
解决方案

I had the same issue. My mistake was that I forgot to add the @Autowired annotation to a constructor.

In my particular case I was trying to configure a CommandLineRunner with final field which was a @Service class.

After correctly adding the @Autowired annotation to MyCommandLineRunner the exception disappeared.

这篇关于java.lang.NoSuchMethodError:org.springframework.web.method.annotation.AbstractNamedValueMethodArgumentResolver:method&lt; init&gt;()V not found的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

08-11 06:15