spring beancopier Cannot invoke “Object.getClass()“ because “cause“ is null异常处理
我们项目用到spring beancopier, 在别的机器上运行正常,代码拉到我机器上就不正常了,抛出异常信息如题。
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.ibm.riskmeasure.rwaservice.service.singletest.impl.SingleTestServiceImpl]: Constructor threw exception; nested exception is java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "cause" is nullat org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:217) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:87) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1315) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]... 51 common frames omitted
Caused by: java.lang.NullPointerException: Cannot invoke "Object.getClass()" because "cause" is nullat org.springframework.cglib.core.CodeGenerationException.<init>(CodeGenerationException.java:25) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:567) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) ~[na:na]at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) ~[na:na]at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.core.internal.LoadingCache.get(LoadingCache.java:34) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData.get(AbstractClassGenerator.java:134) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.core.AbstractClassGenerator.create(AbstractClassGenerator.java:319) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.beans.BeanCopier$Generator.create(BeanCopier.java:95) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at org.springframework.cglib.beans.BeanCopier.create(BeanCopier.java:51) ~[spring-core-5.2.15.RELEASE.jar:5.2.15.RELEASE]at com.ibm.riskmeasure.rwaservice.service.singletest.impl.SingleTestServiceImpl.<init>(SingleTestServiceImpl.java:69) ~[classes/:na]at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) ~[na:na]at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:77) ~[na:na]at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) ~[na:na]at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constructor.java:499) ~[na:na]at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:480) ~[na:na]at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:204) ~[spring-beans-5.2.15.RELEASE.jar:5.2.15.RELEASE]... 53 common frames omitted
经研究发现,这个根源是java版本太新造成的,把我的环境换成java8就好了。当然,也可以升级spring-core到5.3x以上版本。
spring beancopier Cannot invoke “Object.getClass()“ because “cause“ is null异常处理相关推荐
- Java中泛型 Class<T>、T与Class<?>、 Object类和Class类、 object.getClass() 和 Object.class
From:Java中泛型 Class<T>.T 与 Class<?>. Object类 和 Class类. object.getClass() 和 Object.class : ...
- object.getClass()和Object.class的区别
https://blog.csdn.net/xiaokang123456kao/article/details/72859765 首页 博客 学院 下载 图文课 论坛 APP 问答 商城 VIP会员 ...
- java object.getclass_Java Object getClass() 方法
Object getClass() 方法用于获取对象的运行时对象的类. 语法 object.getClass() 参数 无.> 返回值 返回对象的类. 实例 以下实例演示了getClass()方 ...
- 详解Java中的Object.getClass()方法
详解Object.getClass()方法,这个方法的返回值是Class类型,Class c = obj.getClass(); 通过对象c,我们可以获取该对象的所有成员方法,每个成员方法都是一个Me ...
- spring boot之http,页面状态跳转与异常处理实战
spring boot之http,页面状态跳转与异常处理实战 参考文章: (1)spring boot之http,页面状态跳转与异常处理实战 (2)https://www.cnblogs.com/yu ...
- Spring boot +java.awt.HeadlessException: null异常处理
Spring boot +java.awt.HeadlessException: null异常处理 参考文章: (1)Spring boot +java.awt.HeadlessException: ...
- Attempt to invoke virtual method ‘java.lang.Class java.lang.Object.getClass()‘ on a null object refe
原因:fragment多次添加 解决方法: 在对应的xmlt中添加tool:context,必须对应fragment名 <androidx.constraintlayout.widget.Con ...
- 解决Attempt to invoke virtual method '...ListAdapter'on a null object reference
解决:Attempt to invoke virtual method 'voidAndroid.widget.GridView.setAdapter(android.widget.ListAdapt ...
- Android listview使用适配器时出现 Attempt to invoke virtual method xxxxxxxx on a null object reference问题解决方法
一. 异常信息 可以看到问题的提示信息是,意思大概是:空指针,尝试调用方法在一个空的对象上 所以我们来到提示的代码行 错误发生在为textView和editText赋值的语句处,根据提示信息可知,我们 ...
最新文章
- 通过 RDTSC 指令从 CPU 寄存器中直接获取系统时钟
- VUE 事件获取当前组件的属性
- Android如何使用so文件和Android studio中导入so
- desc excel 公式_Excel小技巧之Power Pivot Generate函数、高级DAX函数与常用筛选器函数...
- MySQL-数据类型
- 1gitolite构建git服务器
- GitForWindows工具集(GitBash命令行)
- c 结构体 函数 指针
- ibatis 直接升格为 apache 一级项目了
- 转:应用级集群系统的设计(下)
- 数据结构严蔚敏(c语言版)课后算法题答案-线性表
- Java教务排课系统
- 微型计算机 介绍 gtx980m,卡皇GTX980M的横空出世_笔记本评测-中关村在线
- 脉宽调制功能(PWM)
- 奥运门票系统down机的技术问题
- APP打包后上传遇到ERROR ITMS-90096解决办法
- 【vscode 报错】Couldn‘t start client ESLint
- 不用注册表删除搜狗输入法残留文件夹
- PC817做IO输出使用方法
- 【海外APP】Twitch 全球首屈一指的游戏直播平台