转自:https://blog.csdn.net/licheng989/article/details/28929411

在Bean中有代码

  1. public abstract Axe getAxe();

在配置文件中有

  1. <!-- 指定getAxe方法返回steelAxe
  2. 每次调用getAxe方法将获取新的steelAxe对象 -->
  3. <lookup-method name="getAxe" bean="steelAxe"/>

这样可以协调作用域不同的Bean.但是运行报错

  1. nested exception is java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter

导入cglib-2.2.0.jar包后,继续报错

  1. nested exception is java.lang.NoClassDefFoundError: org/objectweb/asm/Type

原因是Spring中的cglib-nodep-2.x.x.jar与Hibernate中的cglib-2.2.jar相冲突!

两种框架整合时Spring中的cglib-nodep-2.x.x.jar是必须的,取消Hibernate中的cglib-2.2.jar即可

所以,移除cglib-2.2.jar,导入cglib-nodeo-2.2.jar就好了。

下载cglib-nodeo2.2.jar和cglib-2.2.jar

利用lookup方法注入可以让Spring容器重写容器中的Bean的抽象方法,返回查找容器中其他Bean的结果,被查找的Bean通常是一个non-singleton Bean,Spring通过使用CGLIB库修改客户端的二进制码,从而实现上述的要求。

CGLIB库

cglib(Code Generation Library)是一个强大的,高性能,高质量的Code生成类库。它可以在运行期扩展Java类与实现Java接口。
cglib封装了asm,可以在运行期动态生成新的class。
cglib用于AOP,jdk中的proxy必须基于接口,cglib却没有这个限制。

...

这里有一篇博文介绍得很详细CGlib简单介绍

nested exception is java.lang.NoClassDefFoundError: net/sf/cglib/proxy/CallbackFilter的更多相关文章

  1. 【异常】Servlet.service() for servlet [springMvc] in context with path [/orderdishessystem] threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: net/sf/ezmorph/M

    今天做登录的时候,引入json-lib-2.1-jdk15.jar的包时,执行到JSONObject jsonObject = new JSONObject()对象就报标题的那个错. 原来是除了要导入 ...

  2. Java AOP nested exception is java.lang.NoClassDefFoundError: org/aopalliance/aop/Advice || Error creating bean with name 'org.springframework.aop.aspectj.AspectJPointcutAdvisor#0' 两个异常解决办法

    贴出applicationContext.xml <?xml version="1.0" encoding="UTF-8"?> <beans ...

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

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

  4. Handler processing failed; nested exception is java.lang.NoClassDefFoundError: javax/servlet/jsp/jstl/core/Config解决

    出现这个问题往往伴随  HTTP-500错误 报错信息: HTTP Status - Handler processing failed; nested exception is java.lang. ...

  5. jni 类初始化失败(nested exception is java.lang.NoClassDefFoundError)

    nested exception is java.lang.NoClassDefFoundError: Could not initialize class com.netease.facedetec ...

  6. threw exception [Handler processing failed; nested exception is java.lang.NoClassDefFoundError: com/dyuproject/protostuff/MapSchema$MessageFactory] with root cause

    错误记录 前几天朋友问我一个错误,顺便记录一下,关于redis 工具类,protostuff序列化报错. threw exception [Handler processing failed; nes ...

  7. Initialization of bean failed; nested exception is java.lang.NoClassDefFoundError: javax/jms/JMSContext

    参考链接 : https://blog.csdn.net/angus_Lucky/article/details/82811946?utm_source=blogxgwz7 org.springfra ...

  8. 解决Could not open Hibernate Session for transaction; nested exception is java.lang.NoClassDefFoundError: org/hibernate/engine/transaction/spi/TransactionContext

    我使用的是5.2.8的hibernate的jar包,运行的时候却报错Could not open Hibernate Session for transaction; nested exception ...

  9. applicationContext-common.xml]; nested exception is java.lang.NoClassDefFoundError: org/w3c/dom/ElementTraversal

    14:59:16,747 ERROR ContextLoader:350 - Context initialization failedorg.springframework.beans.factor ...

随机推荐

  1. 【转载】HTTP 缓存的四种风味与缓存策略

    原文地址:https://segmentfault.com/a/1190000006689795 HTTP Cache 通过网络获取内容既缓慢,成本又高:大的响应需要在客户端和服务器之间进行多次往返通 ...

  2. .mm c++ oc 混编

    When you create a static library you don't link in the dependent libraries. As a result, when you re ...

  3. Java中IO对象的输入输出流

    输入流: public void inputDemo () throws IOException { //文件名称 String fileName = "d:\\aaa.txt"; ...

  4. 汇编:MSR/MRS/BIC指令

    1.MRS指令MRS指令的格式为:MRS{条件}   通用寄存器,程序状态寄存器(CPSR或SPSR)MRS指令用于将程序状态寄存器的内容传送到通用寄存器中.该指令一般用在以下两种情冴: Ⅰ.当需要改 ...

  5. CAD通过扩展记录实体向数据库读写用户自定义的全局数据(com接口VB语言)

    VB代码实现如下: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 ...

  6. yum插件

    参考文章: http://www.linuxfly.org/post/297/ [root@dnstest07.tbc /home/ahao.mah] #rpm -qa |grep yum yum-p ...

  7. recreate dbcontrol on database 11.2.0.1 using emca

    [oracle@osb ~]$ env | grep ORA ORACLE_SID=ACE ORACLE_BASE=/oracle ORACLE_TERM=xterm ORACLE_HOME=/ora ...

  8. C#学习笔记_14_接口&命名空间

    14_接口&命名空间 接口 一系列规范 语法: 如果一个类的后面既有父类也有接口,那么一定是父类在前,接口靠后 一个类可以实现多个接口 规范:接口命名以大写字母 I 开头 接口中可以包含接口方 ...

  9. PAT 1115 Counting Nodes in a BST

    A Binary Search Tree (BST) is recursively defined as a binary tree which has the following propertie ...

  10. hadoop-hdp-ambari离线安装记录

    一.系统准备 1. 创建user——ambari 2.关闭防火墙 redhat6: chkconfig iptables off /etc/init.d/iptables stop redhat7: ...