首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >原因: org.springframework.web.bind.annotation.RequestMapping.path()[Ljava/lang/String;:java.lang.NoSuchMethodError

原因: org.springframework.web.bind.annotation.RequestMapping.path()[Ljava/lang/String;:java.lang.NoSuchMethodError
EN

Stack Overflow用户
提问于 2015-10-04 20:57:03
回答 1查看 8.9K关注 0票数 2

org.springframework.beans.factory.BeanCreationException:错误创建名为'org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping#0':调用init方法的bean失败;嵌套异常为java.lang.NoSuchMethodError: org.springframework.web.bind.annotation.RequestMapping.path()[Ljava/lang/String; 原因: org.springframework.web.bind.annotation.RequestMapping.path()[Ljava/lang/String;:java.lang.NoSuchMethodError

被这个错误困扰了几个小时。

我的pom.xml

代码语言:javascript
复制
    <?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>com.social</groupId>
    <artifactId>sample-social</artifactId>
    <name>ezhire</name>
    <packaging>war</packaging>
    <version>1.0.0-BUILD-SNAPSHOT</version>
    <properties>
        <java-version>1.8</java-version>
        <org.springframework-version>4.2.1.RELEASE</org.springframework-version>
        <org.springframework.social-version>1.1.0.RELEASE</org.springframework.social-version>
        <org.springframework.social.google-version>1.0.0.RELEASE</org.springframework.social.google-version>
        <org.springframework.security-version>4.0.2.RELEASE</org.springframework.security-version>
        <org.aspectj-version>1.6.10</org.aspectj-version>
        <org.slf4j-version>1.6.6</org.slf4j-version>
    </properties>
    <dependencies>
        <!-- Spring -->
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-context</artifactId>
            <version>${org.springframework-version}</version>
            <exclusions>
                <!-- Exclude Commons Logging in favor of SLF4j -->
                <exclusion>
                    <groupId>commons-logging</groupId>
                    <artifactId>commons-logging</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-webmvc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <!-- Spring Social -->
        <dependency>
            <groupId>org.springframework.social</groupId>
            <artifactId>spring-social-core</artifactId>
            <version>${org.springframework.social-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.social</groupId>
            <artifactId>spring-social-web</artifactId>
            <version>${org.springframework.social-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.social</groupId>
            <artifactId>spring-social-google</artifactId>
            <version>${org.springframework.social.google-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-crypto</artifactId>
            <version>${org.springframework.security-version}</version>
        </dependency>

        <!-- AspectJ -->
        <dependency>
            <groupId>org.aspectj</groupId>
            <artifactId>aspectjrt</artifactId>
            <version>${org.aspectj-version}</version>
        </dependency>

        <!-- Logging -->

        <!-- @Inject -->
        <dependency>
            <groupId>javax.inject</groupId>
            <artifactId>javax.inject</artifactId>
            <version>1</version>
        </dependency>

        <!-- Servlet -->
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>servlet-api</artifactId>
            <version>2.5</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet.jsp</groupId>
            <artifactId>jsp-api</artifactId>
            <version>2.1</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- Jade -->
        <dependency>
            <groupId>de.neuland-bfi</groupId>
            <artifactId>spring-jade4j</artifactId>
            <version>0.4.0</version>
        </dependency>

        <!-- Test -->
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.7</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-jdbc</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-dbcp2</artifactId>
            <version>2.1.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-core</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
        <dependency>
            <groupId>org.springframework</groupId>
            <artifactId>spring-web</artifactId>
            <version>${org.springframework-version}</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <version>2.9</version>
                <configuration>
                    <additionalProjectnatures>
                        <projectnature>org.springframework.ide.eclipse.core.springnature</projectnature>
                    </additionalProjectnatures>
                    <additionalBuildcommands>
                        <buildcommand>org.springframework.ide.eclipse.core.springbuilder</buildcommand>
                    </additionalBuildcommands>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.6</source>
                    <target>1.6</target>
                    <compilerArgument>-Xlint:all</compilerArgument>
                    <showWarnings>true</showWarnings>
                    <showDeprecation>true</showDeprecation>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>org.test.int1.Main</mainClass>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>

应用程序尚未启动。所有spring框架依赖项都在同一个版本上,但仍然会出现相同的错误。

更新

mvn依赖关系的结果:树

代码语言:javascript
复制
[INFO] com.accolite:ezhire:war:1.0.0-BUILD-SNAPSHOT
[INFO] +- org.springframework:spring-context:jar:4.2.1.RELEASE:compile
[INFO] |  +- org.springframework:spring-aop:jar:4.2.1.RELEASE:compile
[INFO] |  |  \- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework:spring-beans:jar:4.2.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:4.2.1.RELEASE:compile
[INFO] +- org.springframework.social:spring-social-core:jar:1.1.0.RELEASE:compil
e
[INFO] +- org.springframework.social:spring-social-web:jar:1.1.0.RELEASE:compile

[INFO] +- org.springframework.social:spring-social-google:jar:1.0.0.RELEASE:comp
ile
[INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.3.3:compile
[INFO] |  +- org.springframework.social:spring-social-config:jar:1.1.0.RELEASE:c
ompile
[INFO] |  +- com.fasterxml.jackson.core:jackson-core:jar:2.3.3:compile
[INFO] |  \- com.fasterxml.jackson.core:jackson-databind:jar:2.3.3:compile
[INFO] +- org.springframework.security:spring-security-crypto:jar:4.0.2.RELEASE:
compile
[INFO] +- org.aspectj:aspectjrt:jar:1.6.10:compile
[INFO] +- javax.inject:javax.inject:jar:1:compile
[INFO] +- javax.servlet:servlet-api:jar:2.5:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.1:provided
[INFO] +- javax.servlet:jstl:jar:1.2:compile
[INFO] +- de.neuland-bfi:spring-jade4j:jar:0.4.0:compile
[INFO] |  +- de.neuland-bfi:jade4j:jar:0.4.0:compile
[INFO] |  |  +- org.apache.commons:commons-jexl:jar:2.1.1:compile
[INFO] |  |  +- commons-collections:commons-collections:jar:3.2.1:compile
[INFO] |  |  +- org.apache.commons:commons-lang3:jar:3.1:compile
[INFO] |  |  +- com.googlecode.concurrentlinkedhashmap:concurrentlinkedhashmap-l
ru:jar:1.3.1:compile
[INFO] |  |  \- org.pegdown:pegdown:jar:1.1.0:compile
[INFO] |  |     +- org.parboiled:parboiled-core:jar:1.0.2:compile
[INFO] |  |     \- org.parboiled:parboiled-java:jar:1.0.2:compile
[INFO] |  |        +- asm:asm:jar:3.3.1:compile
[INFO] |  |        +- asm:asm-util:jar:3.3.1:compile
[INFO] |  |        +- asm:asm-tree:jar:3.3.1:compile
[INFO] |  |        \- asm:asm-analysis:jar:3.3.1:compile
[INFO] |  +- commons-io:commons-io:jar:2.1:compile
[INFO] |  \- org.slf4j:slf4j-api:jar:1.6.0:compile
[INFO] +- junit:junit:jar:4.7:test
[INFO] +- org.springframework:spring-jdbc:jar:4.2.1.RELEASE:compile
[INFO] |  \- org.springframework:spring-tx:jar:4.2.1.RELEASE:compile
[INFO] +- org.apache.commons:commons-dbcp2:jar:2.1.1:compile
[INFO] |  +- org.apache.commons:commons-pool2:jar:2.4.2:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.2:compile
[INFO] +- org.apache.logging.log4j:log4j-api:jar:2.4:compile
[INFO] +- org.apache.logging.log4j:log4j-core:jar:2.4:compile
[INFO] +- org.springframework:spring-core:jar:4.2.1.RELEASE:compile
[INFO] \- org.springframework:spring-web:jar:4.2.1.RELEASE:compile

这里一切都很好。

EN

回答 1

Stack Overflow用户

发布于 2016-04-26 06:58:04

我遇到了这个问题,并解决了it.It,因为jar版本冲突。我遇到问题的过程

    1. 我在pom.xml中首先使用了4.2.0版本的spring
    2. 但我发现这似乎是错误的
    3. 然后,将4.2.0版本更改为4.0.2版本。
    4. 然后将4.0.2.Relation改为4.2.0发布,并在服务器上运行
    5. 我遇到了问题
    6. 最后,我改变了它,它运行。所以,我使用的是4.0.2版本。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/32938328

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档