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";
    }

解决方案 »

  1.   

    this.viewService.doView(Stu);  传的stu是否为null 打印一下或者(JdbcTemplate) Framework.getEngine().getContainer().getComponent("jdbcTemplate");  打印一下jdbcTemplate   查看一下jdbcTemplate 是否为null 。需要这样逐步排查
      

  2.   

    at com.zhfc.soar.zscg.service.Impl.BDCon.doView(BDCon.java:45)
      

  3.   

    一点点测.看对象有没有值先..前面的代码看懂了...后面的是做什么的?JdbcTemplate jdbcTemplate = (JdbcTemplate) Framework.getEngine().getContainer().getComponent("jdbcTemplate");
                return jdbcTemplate.queryForList("select * from CZX_STU where id=" + Stu.getId() + "");
    这段代码时做什么的???