gpt4 book ai didi

Spring 3.2 配置 tx :annotation-driven error in eclipse

转载 作者:行者123 更新时间:2023-12-02 05:18:13 25 4
gpt4 key购买 nike

尝试从 Spring 3.0 迁移 -> 3.2.4

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

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

Error occurred processing XML 'org/springframework/aop/config/AopNamespaceUtils'

在我使用的线路上 <tx:annotation-driven>

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

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

我一直在努力寻找解决方案。我假设它是我忽略的简单东西,但我终其一生都找不到它。

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

  • 我使用 Eclipse 从头创建了配置文件 -> 新文件-> STS bean 配置。
  • 我已确认 maven 已将适当的 jar 安装到类路径。
  • 我已经使用 1.6 和 1.7 版本的 java 进行了编译
  • 使用 -clean 启动 eclipse(以防旧项目和工作区版本留下任何工件)
  • <tx:annotation-driven>使用普通的 Eclipse ctrl+space 添加
  • 显式添加 spring-web 到 pom.xml(Spring 版本 3.2 删除了所需的依赖项,但它没有区别,in or out)
  • 显式添加 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>

最佳答案

Eclipse/Java/PC 无法理解的故障。我唯一的答案是:让电脑过夜不碰它,它会自行修复。也许,取出电池后重新启动会导致相同的结果。

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

关于 Spring 3.2 配置 tx :annotation-driven error in eclipse,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18172675/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com