ERROR:java.lang.reflect.InvocationTargetException
2017-05-27 13:04
651 查看
在项目部署到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 不熟悉造成的,还得多学习,多运用。
相关文章推荐
- java.lang.reflect.InvocationTargetException(java.lang.StackOverflowError)
- method threw error : java.lang.reflect.InvocationTargetException
- javadoc: error - java.lang.reflect.InvocationTarget Exception java.lang.NullPointerException
- Axis2 错误:An error occurred while completing process -java.lang.reflect.InvocationTargetException
- an error occurred while completing process -java.lang.reflect.InvocationTargetException
- 使用Axis插件来从WSDL文件生成代码时"An error occurred while completing process -java.lang.reflect.InvocationTargetException"的错误
- Axis2 错误:An error occurred while completing process -java.lang.reflect.InvocationTargetException
- Axis2 错误:An error occurred while completing process -java.lang.reflect.InvocationTargetException
- 使用Axis2报"An error occurred while completing process -java.lang.reflect.InvocationTargetException"处理
- Eclipse使用axis2生成客户端调用时最后一步出现an error occurred while completing process -java.lang.reflect.InvocationTargetException
- 使用Axis2报"An error occurred while completing process -java.lang.reflect.InvocationTargetException"处理
- struts 2.2.1做例子时报异常:java.lang.RuntimeException: java.lang.reflect.InvocationTargetException 解决
- 该死的错误,http500--java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException异常。
- java.lang.reflect.InvocationTargetException异常的解决
- axis2 java.lang.reflect.InvocationTargetException
- java.lang.reflect.InvocationTargetException
- 关于在struts2中使用java注解报异常 java.lang.reflect.InvocationTargetException
- struts2启动报java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
- Axis2 Plugin Exception: -java.lang.reflect.InvocationTargetException