测试pay.do出现异常

来源:11-10 支付模块所有功能自测

知无止境

2019-10-26

测试pay.do接口获取订单列表
123行 List orderItemList = orderItemMapper.getByOrderNoUserId(orderNo,userId);
的时候出现
java.lang.NullPointerException
com.mmall.service.impl.IOrderServiceImpl.pay(IOrderServiceImpl.java:123)
com.mmall.controller.portal.OrderController.pay(OrderController.java:46)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
java.lang.reflect.Method.invoke(Method.java:498)
org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:214)

打开断点调试第123行跑到

private Object invoke(Object... args) throws Exception {
        ReflectionUtils.makeAccessible(this.getBridgedMethod());

        try {
            return this.getBridgedMethod().invoke(this.getBean(), args);
        } catch (IllegalArgumentException var5) {
            String targetException1 = this.getInvocationErrorMessage(var5.getMessage(), args);
            throw new IllegalArgumentException(targetException1, var5);
        } catch (InvocationTargetException var6) {
            Throwable targetException = var6.getTargetException();
            if(targetException instanceof RuntimeException) {
                throw (RuntimeException)targetException;
            } else if(targetException instanceof Error) {
                throw (Error)targetException;
            } else if(targetException instanceof Exception) {
                throw (Exception)targetException;
            } else {
                String msg = this.getInvocationErrorMessage("Failed to invoke controller method", args);
                throw new IllegalStateException(msg, targetException);
            }
        }
    }

看起来像是mybatis错误,找了半天也没找到什么原因

写回答

1回答

geelylucky

2019-10-26

IOrderServiceImpl第123行有一个对象是null,报错是空指针异常。

0
0

从0开始 独立完成企业级Java电商网站服务端开发

前后端分离,数据库接口设计,架构设计,功能开发,上线运维

9476 学习 · 8804 问题

查看课程