微信支付回调接口 通过sdk解析xml时 报出异常,该如何避免?
发布于 6 年前 作者 mengyan 12413 次浏览 来自 官方Issues

微信支付回调接口

通过sdk解析xml时 报出异常:

org.xml.sax.SAXParseException: Premature end of file.

at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:257) ~[?:1.8.0_231]

at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:339) ~[?:1.8.0_231]

at javax.xml.parsers.DocumentBuilder.parse(DocumentBuilder.java:121) ~[?:1.8.0_231]

at zeroup.cms.utile.wechatsdk.WXPayUtil.xmlToMap(WXPayUtil.java:96) ~[classes!/:0.0.5-SNAPSHOT]

at zeroup.cms.uzo.controller.app.ApiCommonController.wxpaycallback(ApiCommonController.java:356) [classes!/:0.0.5-SNAPSHOT]

at zeroup.cms.uzo.controller.app.ApiCommonController$$FastClassBySpringCGLIB$$48a64c36.invoke(<generated>) [classes!/:0.0.5-SNAPSHOT]

at org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204) [spring-core-5.0.4.RELEASE.jar!/:5.0.4.RELEASE]

at org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:747) [spring-aop-5.0.4.RELEASE.jar!/:5.0.4.RELEASE]

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) [spring-aop-5.0.4.RELEASE.jar!/:5.0.4.RELEASE]

at org.springframework.aop.aspectj.MethodInvocationProceedingJoinPoint.proceed(MethodInvocationProceedingJoinPoint.java:89) [spring-aop-5.0.4.RELEASE.jar!/:5.0.4.RELEASE]

at zeroup.cms.aspect.MyAspect.doAround(MyAspect.java:106) [classes!/:0.0.5-SNAPSHOT]

at sun.reflect.GeneratedMethodAccessor115.invoke(Unknown Source) ~[?:?]

at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_231]

at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_231]

请问引起异常的原因, 以及该如何避免

1 回复

支付、卡券相关的问题请移步至微信支付专区https://developers.weixin.qq.com/community/pay提问,我们会有对应同学来处理

回到顶部