`
Eric.Yan
  • 浏览: 322850 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

Caused by: java.lang.NullPointerException, java.lang.reflect.InvocationTargetExc

阅读更多

动态代理,怎么一直抛这样的错误,

 

 

java.lang.reflect.InvocationTargetException
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at com.controller.DynamicProxy.invoke(DynamicProxy.java:31)
	at $Proxy4.viewRisk(Unknown Source)
	at com.controller.RPDController.viewRisk(RPDController.java:2592)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.springframework.web.servlet.mvc.multiaction.MultiActionController.invokeNamedMethod(MultiActionController.java:471)
	at org.springframework.web.servlet.mvc.multiaction.MultiActionController.handleRequestInternal(MultiActionController.java:408)
	at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:153)
	at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:48)
	at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:790)
	at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:719)
	at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:644)
	at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:549)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at com.util.BasicFilter.doFilter(BasicFilter.java:314)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)
	at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
	at com.controller.CopyOfRPDController.viewRisk(CopyOfRPDController.java:2602)
	... 38 more

 

搜了很多资料,但是都没能解决,有朋友碰到的情况是web.xml中少配了Datasource,有的是Hibernate版本太低,但都不能解决我的问题,

我用的是Spring Jdbc,配置文件中相应的bean也配了,而且debug的时候,动态代理跳到了相应的方法,再往下边就跟不进去了,直接throw InvocationTargetException,然后紧接着是

Caused by: java.lang.NullPointerException

,第一个异常是被封装过的,并不是真正的异常,第二个才是,但是一直找不到是哪里出了问题

 

求高手解答:…………………………………………

分享到:
评论
3 楼 Eric.Yan 2012-07-27  
hyj0903 写道
sounds good

初来乍到,见笑了,呵呵
2 楼 hyj0903 2012-07-27  
sounds good
1 楼 Eric.Yan 2012-07-09  
,终于找到问题了,
spring bean,配置以后,都得用bean配置,不能new,否则会有nullPointer
更准确的说,new哪个class,那么这个class所用到的bean都不起作用,为null
所以,不要去new任何bean,都用xml的配置即可!
问题是这样解决的,
同学们有其他看法可以继续讨论……

相关推荐

Global site tag (gtag.js) - Google Analytics