spring注释配置导致错误

时间:2014-06-13 18:46:44

标签: java spring spring-mvc

我尝试使用注释上下文但总是得到错误。没有关于问题的消息中的信息

dispatcher.servlet.xml

<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:p="http://www.springframework.org/schema/p"
    xmlns:aop="http://www.springframework.org/schema/aop"
    xmlns:util="http://www.springframework.org/schema/util"
    xmlns:mvc="http://www.springframework.org/schema/mvc"
    xmlns:tx="http://www.springframework.org/schema/tx"

    xsi:schemaLocation="
   http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
   http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-4.0.xsd
   http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-4.0.xsd
   http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-4.0.xsd
   http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
   http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.0.xsd">

    <context:annotation-config/>

</beans>

原因:

Severe:   Exception while loading the app
Severe:   Undeployment failed for context /mavenproject6
Severe:   Exception while loading the app : java.lang.IllegalStateException:               
ContainerBase.addChild: start: org.apache.catalina.LifecycleException: org.apache.catalina.LifecycleException: java.lang.NoSuchMethodError: org.springframework.beans.factory.annotation.InjectionMetadata.needsRefresh(Lorg/springframework/beans/factory/annotation/InjectionMetadata;Ljava/lang/Class;)Z

当我使用

时同样的问题
<context:component-scan base-package="com.sourceallies.organization"/>

更新: 下面我为maven附上我的pom.xml: Meaby帮助找到问题。

<dependencies>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>org-apache-commons-logging</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>cglib-2.2</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-aop-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-aspects-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-beans-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-build-src-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-context-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-context-support-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-core-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-expression-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-framework-bom-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-instrument-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-instrument-tomcat-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-jdbc-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-jms-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-messaging-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-orm-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-oxm-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-test-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-tx-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-web-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-webmvc-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-webmvc-portlet-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>spring-websocket-4.0.1.RELEASE</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet.jsp.jstl</groupId>
        <artifactId>javax.servlet.jsp.jstl-api</artifactId>
        <version>1.2.1</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.web</groupId>
        <artifactId>javax.servlet.jsp.jstl</artifactId>
        <version>1.2.2</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-entitymanager</artifactId>
        <version>4.3.5.Final</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>unknown.binary</groupId>
        <artifactId>hibernate-jpa-2.0-api-1.0.1.Final</artifactId>
        <version>SNAPSHOT</version>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>eclipselink</artifactId>
        <version>2.5.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.eclipse.persistence</groupId>
        <artifactId>org.eclipse.persistence.jpa.modelgen.processor</artifactId>
        <version>2.5.1</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.commons</groupId>
        <artifactId>commons-lang3</artifactId>
        <version>3.0.1</version>
    </dependency>
    <dependency>
        <groupId>org.postgresql</groupId>
        <artifactId>postgresql</artifactId>
        <version>9.3-1101-jdbc41</version>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-core</artifactId>
        <version>4.1.8.Final</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring-webmvc</artifactId>
        <version>3.0.4.RELEASE</version>
        <type>jar</type>
    </dependency>
    <dependency>
        <groupId>javax</groupId>
        <artifactId>javaee-web-api</artifactId>
        <version>7.0</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>commons-lang</groupId>
        <artifactId>commons-lang</artifactId>
        <version>2.5</version>
    </dependency>
</dependencies>

0 个答案:

没有答案