spring 3.2配置tx:eclipse中的注释驱动错误

时间:2013-08-11 13:56:51

标签: spring eclipse-plugin migration spring-aop spring-transactions

尝试从Spring 3.0迁移 - > 3.2.4

使用:Eclipse Juno(在64位java 1.7上)和STS 3.3,

问题:Eclipse / STS IDE中的编辑窗口显示:

  

处理XML时出错   '组织/ springframework的/ AOP /配置/ AopNamespaceUtils'

在我使用<tx:annotation-driven>

的行上

编译项目会导致类似的错误。

java.lang.NoClassDefFoundError: org/springframework/aop/config/AopNamespaceUtils

我一直在努力寻找解决方案。我假设这是我忽略的一些简单的东西,但我不能为我的生活找到它。

这是我到目前为止所做的:

  • 我使用Eclipse从头开始创建配置文件 - &gt;新文件 - &GT; STS bean配置。
  • 我已经确认maven已经安装了适当的罐子 classpath。
  • 我用java版本1.6和1.7编译
  • 使用-clean启动eclipse(如果旧项目和工作区版本遗留了任何工件)
  • 使用普通的Eclipse ctrl + space 添加了
  • <tx:annotation-driven>
  • 明确地将 spring-web 添加到pom.xml(Spring版本3.2删除了所需的依赖项,但它没有任何区别,无论是在内还是外)
  • 明确将 spring-aop 添加到pom.xml

任何帮助或见解都将不胜感激。

这是我的config-portlets.xml(在Spring 3.0中使用的早期版本)

    <?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:mvc="http://www.springframework.org/schema/mvc"     xmlns:p="http://www.springframework.org/schema/p"
        xmlns:tx="http://www.springframework.org/schema/tx"     xmlns:util="http://www.springframework.org/schema/util"
        xsi:schemaLocation="http://www.springframework.org/schema/beans     http://www.springframework.org/schema/beans/spring-beans.xsd
            http://www.springframework.org/schema/context     http://www.springframework.org/schema/context/spring-context-3.2.xsd
            http://www.springframework.org/schema/mvc     http://www.springframework.org/schema/mvc/spring-mvc-3.2.xsd
        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.2.xsd
        http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.2.xsd">

    <tx:annotation-driven />  <!-- error here-->
</beans>

我已经在我的pom.xml中明确地包含了spring-aop-3.2.4.Final

    <?xml version="1.0"?>

    <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.sbeko</groupId>
        <artifactId>horse-accounts</artifactId>
        <packaging>war</packaging>
        <name>horse-accounts Portlet</name>
        <version>0.0.1-SNAPSHOT</version>
        <build>
            <plugins>...
                <plugin>
                    <artifactId>maven-compiler-plugin</artifactId>
                    <version>2.5</version>
                    <configuration>
                        <encoding>UTF-8</encoding>
                        <source>1.6</source> <!-- 1.7 tried here as well -->
                        <target>1.6</target>
                    </configuration>
                </plugin>
                <plugin>
 <!-- bunch of stuff taken out for clarity..-->
            </plugin>
            </plugins>
        </build>
        <dependencies>
            <dependency>
<!--  bunch of stuff taken out for clarity..-->
        </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-webmvc-portlet</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.aspectj</groupId>
                <artifactId>aspectjrt</artifactId>
                <version>1.6.8</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-orm</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-test</artifactId>
                <version>${spring.version}</version>
                <scope>test</scope>
            </dependency>
            <dependency>
                <groupId>javax.servlet</groupId>
                <artifactId>servlet-api</artifactId>
                <version>2.4</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>javassist</groupId>
                <artifactId>javassist</artifactId>
                <version>3.9.0.GA</version>
            </dependency>
            <dependency>
                <groupId>mysql</groupId>
                <artifactId>mysql-connector-java</artifactId>
                <version>5.1.25</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>commons-dbcp</groupId>
                <artifactId>commons-dbcp</artifactId>
                <version>1.2.2</version>
            </dependency>
            <dependency>
                <groupId>javax.validation</groupId>
                <artifactId>validation-api</artifactId>
                <version>1.1.0.Final</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-validator</artifactId>
                <version>5.0.1.Final</version>
            </dependency>
            <dependency>
                <groupId>cglib</groupId>
                <artifactId>cglib</artifactId>
                <version>3.0</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aspects</artifactId>
                <version>${spring.version}</version>
            </dependency>
            <dependency>
                <groupId>javax.portlet</groupId>
                <artifactId>portlet-api</artifactId>
                <version>2.0</version>
                <scope>provided</scope>
            </dependency>
            <dependency>
                <groupId>com.thoughtworks.xstream</groupId>
                <artifactId>xstream</artifactId>
                <version>1.4.4</version>
            </dependency>
            <dependency>
                <groupId>joda-time</groupId>
                <artifactId>joda-time</artifactId>
                <version>1.6.2</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-envers</artifactId>
                <version>${hibernate.version}</version>
            </dependency>
            <dependency>
                <groupId>org.hibernate</groupId>
                <artifactId>hibernate-entitymanager</artifactId>
                <version>${hibernate.version}</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-context</artifactId>
                <version>3.2.3.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework</groupId>
                <artifactId>spring-aop</artifactId>
                <version>${spring.version}</version>
            </dependency>
        </dependencies>
        <properties>
            <spring.version>3.2.4.RELEASE</spring.version>
            <hibernate.version>3.5.6-Final</hibernate.version>
        </properties>
    </project>

1 个答案:

答案 0 :(得分:-1)

Eclipse / Java / PC难以理解的故障。我唯一的回答是:让计算机一夜之间不接触它,它就能解决问题。也许,在取出电池后重新启动会导致相同的情况。

我只能怀疑发生了一些垃圾收集,这清除了Java和/或Eclipse中的损坏。