• 背景:学习切面,测试前置通知功能,xml配置如下

    <?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:aop="http://www.springframework.org/schema/aop"
    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.xsd
    http://www.springframework.org/schema/aop
    http://www.springframework.org/schema/aop/spring-aop.xsd" > <bean id="ikAspect" class="com.jing.spring.aop.IKAspect"></bean>
    <bean id="ikAspectBiz" class="com.jing.spring.aop.IKAspectBiz"></bean> <aop:config>
    <aop:aspect id="ikAspectAop" ref="ikAspect">
    <aop:pointcut id="ikPoint" expression="execution(* com.jing.spring.aop.IKAspectBiz.*(..))"></aop:pointcut>
    <aop:before method="aspectBefore" pointcut-ref="ikPoint"></aop:before>
    </aop:aspect>
    </aop:config>
    </beans>
  • 报错:org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException
    Caused by: java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2671)
    at java.lang.Class.getConstructor0(Class.java:3075)
    at java.lang.Class.getDeclaredConstructor(Class.java:2178)
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:80)
    ... 66 more
    Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 71 more
  • 原因:Spring AOP 虽然有自己的AOP功能,但是它是依赖AspectJ来实现的。使用maven搭建的项目pom.xml中,没有引入aspectjweaver包。
  • 解决办法:在pom.xml中引入aspectjweaver包。
     <!-- https://mvnrepository.com/artifact/org.aspectj/aspectjweaver -->
    <dependency>
    <groupId>org.aspectj</groupId>
    <artifactId>aspectjweaver</artifactId>
    <version>1.9.2</version>
    </dependency>
  • 测试成功
  • Next

Spring错误——Spring AOP——org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException的更多相关文章

  1. Spring.之.报错:Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException

    Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWo ...

  2. could not find class that it depends on; nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$ReflectionWorldException

    © 版权声明:本文为博主原创文章,转载请注明出处 1.问题描述 搭建SSH框架启动报错如下: 六月 07, 2017 2:34:34 下午 org.springframework.web.contex ...

  3. Spring3.x错误----java.lang.ClassNotFoundException:org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWorldException

    Spring3.x错误: 解决方法: 缺少aspectjweaver.jar包 下载地址: https://cn.jarfire.org/aspectjweaver.html

  4. Spring系列: 使用aop报错:nested exception is java.lang.NoClassDefFoundError: org/aspectj/weaver/reflect/ReflectionWorld$Refle

    写了个最简单的aop例子 配置文件如下 <?xml version="1.0" encoding="UTF-8"?> <beans xmlns ...

  5. Caused by: java.lang.ClassNotFoundException: org.aspectj.weaver.reflect.ReflectionWorld$ReflectionWo

    1.错误描述 usage: java org.apache.catalina.startup.Catalina [ -config {pathname} ] [ -nonaming ] { -help ...

  6. NoClassDefFoundError:aspectj/weaver/reflect/ReflectionWorld$Reflection

    Exception in thread "main" org.springframework.beans.factory.BeanDefinitionStoreException: ...

  7. Spring 中基于 AOP 的 @AspectJ

    Spring 中基于 AOP 的 @AspectJ @AspectJ 作为通过 Java 5 注释注释的普通的 Java 类,它指的是声明 aspects 的一种风格. 通过在你的基于架构的 XML ...

  8. spring学习(二) ———— AOP之AspectJ框架的使用

    前面讲解了spring的特性之一,IOC(控制反转),因为有了IOC,所以我们都不需要自己new对象了,想要什么,spring就给什么.而今天要学习spring的第二个重点,AOP.一篇讲解不完,所以 ...

  9. Spring中基于AOP的@AspectJ

    以下内容引用自http://wiki.jikexueyuan.com/project/spring/aop-with-spring-framenwork/aspectj-based-aop-with- ...

随机推荐

  1. mac重启,开启apache时报错~~~镜像没有找到

    mac重启apache时,报类似下面的错 dyld: Library not loaded: /usr/local/lib/libjpeg8.dylib Referenced from: /usr/l ...

  2. 注意兼容浮点运算误差 0.7 + 0.1 ==0.8 为false

    所以比较 汇总或者计算的时候注意确定精度0.7 + 0.1 ==0.8 换成 Math.abs(0.7 + 0.1 ==0.8)<0.0001参考下

  3. C语言编程(多线程)

    C语言中多线程编程包括的文件:#include<pthread.h>(linux环境下) pthread_t //线程函数返回类型 pthread_mutrex_t //互斥锁类型 int ...

  4. SQL基础语法提纲

    一.SQL需知5点 1.SQL是Structured Query Language的缩写,是用来访问关系型数据库的,非过程化的,高级编程语言. 2.SQL具有语法高度综合统一,高度的非过程化,对集合进 ...

  5. Spring Boot 入门day01

    一.Spring Boot入门 1.Spring Boot简介 Spring Boot是由Pivotal团队提供的全新框架,其设计目的是用来简化新Spring应用的初始搭建以及开发过程.该框架使用了特 ...

  6. MAVEN_day03 整合SSH框架

    一.整合SSH工程环境准备 1.创建MAVEN工程>>添加>>"web.xml"文件解决工程红色叹号. new Maven Project>>在 ...

  7. bugfree3.0.1-BUG解决方案修改

    该篇内容来自文档“masterBugFree2.pdf”,记录在这里. 1.如何将解决方案改为中文 在\Bugfree\Lang\ZH_CN_UTF-8 \_COMMON.php 文件中做如下修改/* ...

  8. [js]es6语法: 字符串和数组的方法

    s的方法 根据index取value: 取首尾项,arr[0], arr[arr.length-1] 根据value取index(判断是否包含子字符串): s.indexOf 栗子: 'maotai' ...

  9. 强迫症犯了,忍不住赞一下slf4j包Logger.java的优雅代码

    如下是slf4j-api包下的Logger接口类里其中几个方法的声明: package org.slf4j; public interface Logger { /** * Log a message ...

  10. hive 调优手段

    调优手段 ()利用列裁剪 当待查询的表字段较多时,选取需要使用的字段进行查询,避免直接select *出大表的所有字段,以免当使用Beeline查询时控制台输出缓冲区被大数据量撑爆. ()JOIN避免 ...