新人空指针异常求助

qq_34835094 2016-04-29 04:25:24
java.lang.NullPointerException
at com.zhfc.soar.zscg.service.Impl.BDCon.doView(BDCon.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:317)
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:183)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:150)
at org.springframework.transaction.interceptor.TransactionInterceptor$1.proceedWithInvocation(TransactionInterceptor.java:96)
at org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:260)
at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:94)
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:204)
at com.sun.proxy.$Proxy1324.doView(Unknown Source)
at com.zhfc.soar.zscg.action.StuAction.view(StuAction.java:110)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)



代码如下
public List doView(StuMassage Stu){
String id=Stu.getId();
JdbcTemplate jdbcTemplate = (JdbcTemplate) Framework.getEngine().getContainer().getComponent("jdbcTemplate");
return jdbcTemplate.queryForList("select * from CZX_STU where id=" + Stu.getId() + "");
}
--------------------------------------------------------------------------------------
public String view(){
try {
this.viewService.doView(Stu);
}catch (Exception e){
e.printStackTrace();
}
return "success";
}
...全文
124 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
shumo1128 2016-04-29
  • 打赏
  • 举报
回复
一点点测.看对象有没有值先..前面的代码看懂了...后面的是做什么的? JdbcTemplate jdbcTemplate = (JdbcTemplate) Framework.getEngine().getContainer().getComponent("jdbcTemplate"); return jdbcTemplate.queryForList("select * from CZX_STU where id=" + Stu.getId() + ""); 这段代码时做什么的???
  • 打赏
  • 举报
回复
at com.zhfc.soar.zscg.service.Impl.BDCon.doView(BDCon.java:45)
qq_34835094 2016-04-29
  • 打赏
  • 举报
回复
好的 我试试
qq_20960265 2016-04-29
  • 打赏
  • 举报
回复
this.viewService.doView(Stu); 传的stu是否为null 打印一下或者(JdbcTemplate) Framework.getEngine().getContainer().getComponent("jdbcTemplate"); 打印一下jdbcTemplate 查看一下jdbcTemplate 是否为null 。需要这样逐步排查

62,626

社区成员

发帖
与我相关
我的任务
社区描述
Java 2 Standard Edition
社区管理员
  • Java SE
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧