请稍等 ...
×

采纳答案成功!

向帮助你的同学说点啥吧!感谢那些助人为乐的人

8-4 支付功能测试通过,但是在前端支付不成功

前端按下支付按钮报500错误
全部openid都改成了oTgZpwWMR_0u8BaXgYBTSdR8mx1U

所有代码都在GitHub里了
https://github.com/ajims/sell
图片描述

已经尝试这两位同学的办法,固定死了一个openid
https://coding.imooc.com/learn/questiondetail/179877.html
https://www.imooc.com/article/259514
修改了文件之后还是报500错误
http://sell.com/sell/buyer/order/create
图片描述
图片描述

ide报错为
2020-06-08 00:15:57,339 - Starting SellApplication on 啊jims with PID 1252 (started by 啊jims in D:\ピクチャ\idea2019\ideaIU-2019.3.1\program\sell)
2020-06-08 00:15:57,345 - No active profile set, falling back to default profiles: default
2020-06-08 00:15:57,392 - Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6b2ea799: startup date [Mon Jun 08 00:15:57 GMT+08:00 2020]; root of context hierarchy
2020-06-08 00:15:57,606 - HV000001: Hibernate Validator 5.3.5.Final
2020-06-08 00:15:58,739 - No MyBatis mapper was found in ‘[com.imooc]’ package. Please check your configuration.
2020-06-08 00:15:59,236 - JSR-330 ‘javax.inject.Inject’ annotation found and supported for autowiring
2020-06-08 00:15:59,870 - Tomcat initialized with port(s): 8080 (http)
2020-06-08 00:15:59,884 - Starting service Tomcat
2020-06-08 00:15:59,885 - Starting Servlet Engine: Apache Tomcat/8.5.14
2020-06-08 00:16:00,140 - Initializing Spring embedded WebApplicationContext
2020-06-08 00:16:00,141 - Root WebApplicationContext: initialization completed in 2749 ms
2020-06-08 00:16:00,333 - Mapping servlet: ‘dispatcherServlet’ to [/]
2020-06-08 00:16:00,339 - Mapping filter: ‘characterEncodingFilter’ to: [/]
2020-06-08 00:16:00,340 - Mapping filter: ‘hiddenHttpMethodFilter’ to: [/
]
2020-06-08 00:16:00,340 - Mapping filter: ‘httpPutFormContentFilter’ to: [/]
2020-06-08 00:16:00,340 - Mapping filter: ‘requestContextFilter’ to: [/
]
2020-06-08 00:16:01,116 - Building JPA container EntityManagerFactory for persistence unit 'default’
2020-06-08 00:16:01,140 - HHH000204: Processing PersistenceUnitInfo [
name: default
…]
2020-06-08 00:16:01,578 - HHH000412: Hibernate Core {5.0.12.Final}
2020-06-08 00:16:01,580 - HHH000206: hibernate.properties not found
2020-06-08 00:16:01,582 - HHH000021: Bytecode provider name : javassist
2020-06-08 00:16:01,701 - HCANN000001: Hibernate Commons Annotations {5.0.1.Final}
2020-06-08 00:16:01,946 - HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect
2020-06-08 00:16:06,596 - Initialized JPA EntityManagerFactory for persistence unit 'default’
2020-06-08 00:16:21,370 - Looking for @ControllerAdvice: org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@6b2ea799: startup date [Mon Jun 08 00:15:57 GMT+08:00 2020]; root of context hierarchy
2020-06-08 00:16:21,444 - Mapped “{[/buyer/order/create],methods=[POST]}” onto public com.imooc.VO.ResultVO<java.util.Map<java.lang.String, java.lang.String>> com.imooc.controller.BuyerOrderController.create(com.imooc.form.OrderForm,org.springframework.validation.BindingResult)
2020-06-08 00:16:21,445 - Mapped “{[/buyer/order/list],methods=[GET]}” onto public com.imooc.VO.ResultVO<java.util.List<com.imooc.dto.OrderDTO>> com.imooc.controller.BuyerOrderController.list(java.lang.String,java.lang.Integer,java.lang.Integer)
2020-06-08 00:16:21,445 - Mapped “{[/buyer/order/detail],methods=[GET]}” onto public com.imooc.VO.ResultVO<com.imooc.dto.OrderDTO> com.imooc.controller.BuyerOrderController.detail(java.lang.String,java.lang.String)
2020-06-08 00:16:21,445 - Mapped “{[/buyer/order/cancel],methods=[POST]}” onto public com.imooc.VO.ResultVO com.imooc.controller.BuyerOrderController.cancel(java.lang.String,java.lang.String)
2020-06-08 00:16:21,446 - Mapped “{[/buyer/product/list],methods=[GET]}” onto public com.imooc.VO.ResultVO com.imooc.controller.BuyerProductController.list()
2020-06-08 00:16:21,447 - Mapped “{[/pay/create],methods=[GET]}” onto public org.springframework.web.servlet.ModelAndView com.imooc.controller.PayController.create(java.lang.String,java.lang.String,java.util.Map<java.lang.String, java.lang.Object>)
2020-06-08 00:16:21,448 - Mapped “{[/wechat/userInfo],methods=[GET]}” onto public java.lang.String com.imooc.controller.WechatController.userInfo(java.lang.String,java.lang.String)
2020-06-08 00:16:21,448 - Mapped “{[/wechat/authorize],methods=[GET]}” onto public java.lang.String com.imooc.controller.WechatController.authorize(java.lang.String)
2020-06-08 00:16:21,449 - Mapped “{[/weixin/auth],methods=[GET]}” onto public void com.imooc.controller.WeixinController.auth(java.lang.String)
2020-06-08 00:16:21,451 - Mapped “{[/error]}” onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.BasicErrorController.error(javax.servlet.http.HttpServletRequest)
2020-06-08 00:16:21,451 - Mapped “{[/error],produces=[text/html]}” onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2020-06-08 00:16:21,485 - Mapped URL path [/webjars/] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-06-08 00:16:21,485 - Mapped URL path [/
] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-06-08 00:16:21,525 - Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2020-06-08 00:16:21,909 - ClassTemplateLoader for Spring macros added to FreeMarker configuration
2020-06-08 00:16:22,065 - Registering beans for JMX exposure on startup
2020-06-08 00:16:22,084 - Initializing ProtocolHandler [“http-nio-8080”]
2020-06-08 00:16:22,098 - Starting ProtocolHandler [“http-nio-8080”]
2020-06-08 00:16:22,113 - Using a shared selector for servlet write/read
2020-06-08 00:16:22,137 - Tomcat started on port(s): 8080 (http)
2020-06-08 00:16:22,142 - Started SellApplication in 25.439 seconds (JVM running for 27.867)
2020-06-08 00:17:03,791 - Initializing Spring FrameworkServlet 'dispatcherServlet’
2020-06-08 00:17:03,791 - FrameworkServlet ‘dispatcherServlet’: initialization started
2020-06-08 00:17:03,818 - FrameworkServlet ‘dispatcherServlet’: initialization completed in 27 ms
2020-06-08 00:17:40,989 - HHH000397: Using ASTQueryTranslatorFactory
Hibernate: select productinf0_.product_id as product_1_3_, productinf0_.category_type as category2_3_, productinf0_.product_description as product_3_3_, productinf0_.product_icon as product_4_3_, productinf0_.product_name as product_5_3_, productinf0_.product_price as product_6_3_, productinf0_.product_status as product_7_3_, productinf0_.product_stock as product_8_3_ from product_info productinf0_ where productinf0_.product_status=?
Hibernate: select productcat0_.category_id as category1_2_, productcat0_.category_name as category2_2_, productcat0_.category_type as category3_2_ from product_category productcat0_ where productcat0_.category_type in (? , ? , ?)
2020-06-08 00:17:50,094 - 【创建订单】 参数不正确, orderForm=OrderForm(name=111, phone=111, address=111, openid=, items=[{“productId”:“4321”,“productQuantity”:1}])
2020-06-08 00:17:50,509 - Servlet.service() for servlet [dispatcherServlet] in context with path [/sell] threw exception [Request processing failed; nested exception is com.imooc.exception.SellException: openid必填] with root cause
com.imooc.exception.SellException: openid必填
at com.imooc.controller.BuyerOrderController.create(BuyerOrderController.java:45)
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 org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:205)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:133)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:97)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:872)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:661)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:742)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:231)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:105)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:81)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:193)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:166)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:478)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:80)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:342)
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:799)
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
at org.apache.coyote.AbstractProtocolConnectionHandler.process(AbstractProtocol.java:861)atorg.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:861) at org.apache.tomcat.util.net.NioEndpointConnectionHandler.process(AbstractProtocol.java:861)atorg.apache.tomcat.util.net.NioEndpointSocketProcessor.doRun(NioEndpoint.java:1455)
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutorWorker.run(ThreadPoolExecutor.java:624)atorg.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624) at org.apache.tomcat.util.threads.TaskThreadWorker.run(ThreadPoolExecutor.java:624)atorg.apache.tomcat.util.threads.TaskThreadWrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:748)

正在回答 回答被采纳积分+3

3回答

提问者 啊jimes 2020-06-09 17:38:55

改了之后还是报500的错误,后台报错没有获取到openid,不知道哪里错了

2020-06-08 00:17:50,094 - 【创建订单】 参数不正确, orderForm=OrderForm(name=111, phone=111, address=111, openid=, items=[{“productId”:“4321”,“productQuantity”:1}])

改了之后openid还是空的,不知道是没改成功还是其他地方错了



https://github.com/ajims/sell

老师可以帮忙看看我的代码吗,不知道是否是代码出现了问题。



0 回复 有任何疑惑可以回复我~
  • 1. 前端代码不要改
    2. 在后端代码里替换openid, 拿到orderForm后,可以把里面的openid替换掉
    回复 有任何疑惑可以回复我~ 2020-06-15 20:16:20
廖师兄 2020-06-09 13:49:20

已经尝试这两位同学的办法,固定死了一个openid
https://coding.imooc.com/learn/questiondetail/179877.html
https://www.imooc.com/article/259514
修改了文件之后还是报500错误


500错误具体错误信息是什么呢。如果固定死了openid, 那么是不会再报【openid必填】的错误的。

0 回复 有任何疑惑可以回复我~
提问者 啊jimes 2020-06-08 21:04:21

@廖师兄

0 回复 有任何疑惑可以回复我~
问题已解决,确定采纳
还有疑问,暂不采纳
意见反馈 帮助中心 APP下载
官方微信