ERROR:java.lang.reflect.InvocationTargetException
来源:互联网 发布:萤石软件下载 编辑:程序博客网 时间:2024/06/05 12:00
在项目部署到Tomcat容器上后,运行Tomcat是没有任何异常的,但是发送请求是就会出现以下错误:
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.alcatel.vim.service.KpiService.getKpiValue(KpiService.java:73)
at com.alcatel.vim.service.KpiService.getKPIResult(KpiService.java:58)
at com.alcatel.vim.service.PMJobService.getKPIResult(PMJobService.java:156)
at com.alcatel.vim.service.pmjob.BasicPMJobTask.run(BasicPMJobTask.java:168)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at java.util.StringTokenizer.<init>(StringTokenizer.java:199)
at org.snmp4j.util.SimpleOIDTextFormat.parseOID(SimpleOIDTextFormat.java:102)
at org.snmp4j.util.SimpleOIDTextFormat.parse(SimpleOIDTextFormat.java:150)
at org.snmp4j.smi.OID.parseDottedString(OID.java:165)
at org.snmp4j.smi.OID.<init>(OID.java:83)
at com.alcatel.vim.util.SnmpUtil.getPdu(SnmpUtil.java:137)
at com.alcatel.vim.service.KpiService.getHypCpuLoad(KpiService.java:317)
... 9 more
原因是:在我的一类里,是通过框架注释的(
①
@Service
public class KpiService {}
)
但是,我在调用Kpiservice 中的方法/函数时,我使用了这样的方法(
②
@Inject
private Kpiservice kpiService;
调用方法/函数:
kpiServicel.getHostIP();
)
应该是不用①和②两步的,方法getHostIP();是public的,直接使用getHostIP();调用就行了,多了①和②两步,不仅多此一举,而且造成了程序的异常出现。
最终还是自己对框架的注释,如@Service、@Inject 不熟悉造成的,还得多学习,多运用。
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at com.alcatel.vim.service.KpiService.getKpiValue(KpiService.java:73)
at com.alcatel.vim.service.KpiService.getKPIResult(KpiService.java:58)
at com.alcatel.vim.service.PMJobService.getKPIResult(PMJobService.java:156)
at com.alcatel.vim.service.pmjob.BasicPMJobTask.run(BasicPMJobTask.java:168)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
at java.util.StringTokenizer.<init>(StringTokenizer.java:199)
at org.snmp4j.util.SimpleOIDTextFormat.parseOID(SimpleOIDTextFormat.java:102)
at org.snmp4j.util.SimpleOIDTextFormat.parse(SimpleOIDTextFormat.java:150)
at org.snmp4j.smi.OID.parseDottedString(OID.java:165)
at org.snmp4j.smi.OID.<init>(OID.java:83)
at com.alcatel.vim.util.SnmpUtil.getPdu(SnmpUtil.java:137)
at com.alcatel.vim.service.KpiService.getHypCpuLoad(KpiService.java:317)
... 9 more
原因是:在我的一类里,是通过框架注释的(
①
@Service
public class KpiService {}
)
但是,我在调用Kpiservice 中的方法/函数时,我使用了这样的方法(
②
@Inject
private Kpiservice kpiService;
调用方法/函数:
kpiServicel.getHostIP();
)
应该是不用①和②两步的,方法getHostIP();是public的,直接使用getHostIP();调用就行了,多了①和②两步,不仅多此一举,而且造成了程序的异常出现。
最终还是自己对框架的注释,如@Service、@Inject 不熟悉造成的,还得多学习,多运用。
阅读全文
0 0
- ERROR:java.lang.reflect.InvocationTargetException
- method threw error : java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- Java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- log4jdbc日志框架介绍
- php常用函数
- 实用计算机视觉 -- 一种基于直方图的最优阈值计算方法
- Spring+Springmvc实现文件上传
- 判断今天是今年的第几天(1)
- ERROR:java.lang.reflect.InvocationTargetException
- 统计学习精要 (Elements of Statistical Learning ) 习题 5.13
- spark快速入门
- Java类与对象
- LeetCode 350. Intersection of Two Array
- C语言程序设计(28)
- 抓取网页内容
- 套接字总结
- C和C++混合编译