java - Spring 3.1、Aspect、Tomcat - 循环错误

标签 java spring tomcat aspectj

我有一个非常复杂的 Web 应用程序,其中整个 DAO 已外包给一个 @Aspect 类,该类将在访问需要这些实体的方法时加载数据库实体。

当从 netbeans 启动网络应用程序时,整个方法运行良好。但是,当我尝试将相同的 .war 部署到独立的 tomcat(相同版本的 tomcat,相同版本的 java)时,我在启动时遇到以下异常:

引起:java.lang.IllegalArgumentException: Advice precedence circularity error

而且我无法弄清楚是什么导致了问题以及为什么应用程序在通过 netbeans 启动时运行良好。

Maven 配置:

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>2.3.2</version>
            <configuration>
                <fork>false</fork>
                <meminitial>256m</meminitial>
                <maxmem>768m</maxmem>
                <source>1.6</source>
                <target>1.6</target>
                <encoding>${project.build.sourceEncoding}</encoding>
                <showWarnings>true</showWarnings>
                <showDeprecation>false</showDeprecation>
                <debug>true</debug>
                <debuglevel>lines,vars,source</debuglevel>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.2</version>
            <configuration>
                <archive>
                    <manifest>
                        <addClasspath>true</addClasspath>
                    </manifest>
                </archive>
                <webXml>src\main\webapp\WEB-INF\web.xml</webXml>
            </configuration>
        </plugin>

Spring :3.1.0.RELEASE:

<context:annotation-config />
<context:component-scan base-package="my.package" />
<mvc:annotation-driven />
<mvc:resources mapping="/resources/**" location="/resources/" />
<aop:aspectj-autoproxy />

Java 版本:

java -version
java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

老实说,我不知道我应该在这篇文章中包含哪些信息,因为我什至不知道从哪里开始...如果需要,请随时询问更多信息。

最佳答案

这不一定是完整的答案,但链接应该会有帮助:

听起来这里的区别似乎是您的机器返回特定类的声明方法的顺序不同,这改变了方面建议的运行方式:

Spring uses getDeclaredMethods to determine the order of the advices, but getDeclaredMethods returns methods in unspecified order. (see more)

还有一个与您的问题非常相似的 Spring ticket: SPR-5314

希望对您有所帮助。祝你好运。

关于java - Spring 3.1、Aspect、Tomcat - 循环错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10110248/

相关文章:

java - spring boot多个模块如何继承application.properties

java - 我怎样才能让我的 CGLIB 代理类与 spring 框架的 ReflectionUtils 一起工作?

java - 在Springboot中创建2个日志文件

java - Tomcat catalina.out 是 40GB

java 小服务程序。重定向到静态页面不起作用

java - 无法使用 spring data 从 mongodb 获取存储的文档

java - Spring MVC不加载css、js文件到静态html页面

tomcat - 我如何在两个不同的环境中使用 maven tomcat 插件?

java - 无法更新对话框 fragment 上的 fragment 关闭

java - 使用 spring 启用 WebSocket