我正在尝试将Papal与我的Spring Web Service集成。我正在引用Advanced Server Integration并使用此SDK Create Payment Sample。
这是我的客户端代码
<script src="https://www.paypalobjects.com/api/checkout.js">
</script>
<h1>Paypal Integration - Advanced Server Side Integration</h1>
<div id="paypal-button-container"></div>
<script>
// Render the PayPal button
paypal.Button.render({
// Set your environment
env: 'sandbox', // sandbox | production
// Wait for the PayPal button to be clicked
payment: function() {
// Make a call to the merchant server to set up the payment
return paypal.request.post('http://localhost:8080/api/createpayment').then(function(res) {
console.log(res);
return res.payToken;
});
},
// Wait for the payment to be authorized by the customer
onAuthorize: function(data, actions) {
// Make a call to the merchant server to execute the payment
return paypal.request.post('http://localhost:8080/api/executepayment', {
payToken: data.paymentID,
payerId: data.payerID
}).then(function(res) {
console.log(res);
document.querySelector('#paypal-button-container').innerText = 'Payment Complete!';
});
}
}, '#paypal-button-container');
</script>
这是我的Web服务
@RequestMapping(value = "/executepayment", method = RequestMethod.POST)
public @ResponseBody
Payment executePayment(HttpServletRequest request, HttpServletResponse response) {
Map<String, String> map = new HashMap<String, String>();
Payment createdPayment = null;
try {
final String clientID = "<clientId>";
final String clientSecret = "<clientSecret>";
// ### Api Context
// Pass in a `ApiContext` object to authenticate
// the call and to send a unique request id
// (that ensures idempotency). The SDK generates
// a request id if you do not pass one explicitly.
APIContext apiContext = new APIContext(clientID, clientSecret, "sandbox");
if (request.getParameter("payerId") != null) {
logger.info("Payment Execution");
Payment payment = new Payment();
if (request.getParameter("guid") != null) {
payment.setId(map.get(request.getParameter("guid")));
}
PaymentExecution paymentExecution = new PaymentExecution();
paymentExecution.setPayerId(request.getParameter("payerId"));
createdPayment = payment.execute(apiContext, paymentExecution);
logger.info("Executed Payment - Request :: \n " + Payment.getLastRequest());
logger.info("Exceuted Payment - Response :; \n " + Payment.getLastResponse());
//ResultPrinter.addResult(req, resp, "Executed The Payment", Payment.getLastRequest(), Payment.getLastResponse(), null);
//ResultPrinter.addResult(req, resp, "Executed The Payment", Payment.getLastRequest(), null, e.getMessage());
}
} catch (Exception e) {
logger.error("Execute Payment Exception ");
e.printStackTrace();
}
return createdPayment;
}
当我点击Paypal Checkout按钮时。它弹出Paypal登录屏幕,授权工作正常。之后,我尝试使用我的API执行付款。但是当我调用500 Internal Server Error
方法时,我收到payment.execute(apiContext, paymentExecution)
。这是完整的Stacktrace
[http-nio-8080-exec-42] ERROR com.paypal.base.HttpConnection - Response code: 500 Error response: <html><head><title>JBoss Web/7.0.17.Final - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: com.paypal.foundation.security.ObjectEncryptionException.<init>(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116) org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:336) org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249) org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153) org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181) org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289) org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209) javax.servlet.http.HttpServlet.service(HttpServlet.java:754) org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265) org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23) com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>root cause</b> <pre>org.apache.cxf.interceptor.Fault: com.paypal.foundation.security.ObjectEncryptionException.<init>(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:170) org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:136) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101) org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94) org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249) org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153) org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181) org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289) org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209) javax.servlet.http.HttpServlet.service(HttpServlet.java:754) org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265) org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23) com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>root cause</b> <pre>java.lang.NoSuchMethodError: com.paypal.foundation.security.ObjectEncryptionException.<init>(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V com.paypal.foundation.security.InvalidInputDataException.<init>(InvalidInputDataException.java:11) com.paypal.foundation.security.crypto.AbstractIdEncryptor.decrypt(AbstractIdEncryptor.java:81) com.paypal.domains.common.utils.crypto.impl.IdCryptUtilImpl.decryptId(IdCryptUtilImpl.java:103) com.paypal.domains.payment.dal.dao.impl.PaymentsFacadeDAOImpl.findPaymentByEncryptedId(PaymentsFacadeDAOImpl.java:301) com.paypal.domains.payment.bo.impl.PaymentBOFactory.getPaymentForRoutingCheck(PaymentBOFactory.java:340) com.paypal.api.service.impl.PaymentServiceImpl.checkRoutingToSymphony(PaymentServiceImpl.java:2167) com.paypal.api.service.impl.PaymentServiceImpl.executePayment(PaymentServiceImpl.java:811) sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188) org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101) org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94) org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249) org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153) org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181) org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289) org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209) javax.servlet.http.HttpServlet.service(HttpServlet.java:754) org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265) org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerReque2017-05-03 17:48:33 ERROR UserController:740 - Create Payment Exception
stFilter.java:76) com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23) com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the JBoss Web/7.0.17.Final logs.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.17.Final</h3></body></html>
response-code: 500 details: null
at com.paypal.base.rest.PayPalRESTException.createFromHttpErrorException(PayPalRESTException.java:72)
at com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:431)
at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:295)
at com.paypal.base.rest.PayPalResource.configureAndExecute(PayPalResource.java:228)
at com.paypal.api.payments.Payment.execute(Payment.java:226)
at com.statementgames.controllers.UserController.createPayment(UserController.java:640)
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.invoke(InvocableHandlerMethod.java:215)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:132)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:104)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandleMethod(RequestMappingHandlerAdapter.java:749)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:689)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:83)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:938)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:870)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:961)
at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:863)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:648)
at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:837)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at com.statementgames.filters.CORSFilter.doFilter(CORSFilter.java:54)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:509)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1104)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:684)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1520)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1476)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Caused by: com.paypal.base.exception.HttpErrorException: Response code: 500 Error response: <html><head><title>JBoss Web/7.0.17.Final - Error report</title><style><!--H1 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:22px;} H2 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:16px;} H3 {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;font-size:14px;} BODY {font-family:Tahoma,Arial,sans-serif;color:black;background-color:white;} B {font-family:Tahoma,Arial,sans-serif;color:white;background-color:#525D76;} P {font-family:Tahoma,Arial,sans-serif;background:white;color:black;font-size:12px;}A {color : black;}A.name {color : black;}HR {color : #525D76;}--></style> </head><body><h1>HTTP Status 500 - </h1><HR size="1" noshade="noshade"><p><b>type</b> Exception report</p><p><b>message</b> <u></u></p><p><b>description</b> <u>The server encountered an internal error () that prevented it from fulfilling this request.</u></p><p><b>exception</b> <pre>java.lang.RuntimeException: org.apache.cxf.interceptor.Fault: com.paypal.foundation.security.ObjectEncryptionException.<init>(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V org.apache.cxf.interceptor.AbstractFaultChainInitiatorObserver.onMessage(AbstractFaultChainInitiatorObserver.java:116) org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:336) org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249) org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153) org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181) org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289) org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209) javax.servlet.http.HttpServlet.service(HttpServlet.java:754) org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265) org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23) com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>root cause</b> <pre>org.apache.cxf.interceptor.Fault: com.paypal.foundation.security.ObjectEncryptionException.<init>(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V org.apache.cxf.service.invoker.AbstractInvoker.createFault(AbstractInvoker.java:170) org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:136) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101) org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94) org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249) org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153) org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181) org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289) org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209) javax.servlet.http.HttpServlet.service(HttpServlet.java:754) org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265) org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23) com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>root cause</b> <pre>java.lang.NoSuchMethodError: com.paypal.foundation.security.ObjectEncryptionException.<init>(Lcom/paypal/platform/ec/InternalError;Ljava/lang/Throwable;[Ljava/lang/String;)V com.paypal.foundation.security.InvalidInputDataException.<init>(InvalidInputDataException.java:11) com.paypal.foundation.security.crypto.AbstractIdEncryptor.decrypt(AbstractIdEncryptor.java:81) com.paypal.domains.common.utils.crypto.impl.IdCryptUtilImpl.decryptId(IdCryptUtilImpl.java:103) com.paypal.domains.payment.dal.dao.impl.PaymentsFacadeDAOImpl.findPaymentByEncryptedId(PaymentsFacadeDAOImpl.java:301) com.paypal.domains.payment.bo.impl.PaymentBOFactory.getPaymentForRoutingCheck(PaymentBOFactory.java:340) com.paypal.api.service.impl.PaymentServiceImpl.checkRoutingToSymphony(PaymentServiceImpl.java:2167) com.paypal.api.service.impl.PaymentServiceImpl.executePayment(PaymentServiceImpl.java:811) sun.reflect.GeneratedMethodAccessor168.invoke(Unknown Source) sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) java.lang.reflect.Method.invoke(Method.java:606) org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188) org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204) org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101) org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58) org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94) org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272) org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121) org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:249) org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222) org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153) org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:181) org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:289) org.apache.cxf.transport.servlet.AbstractHTTPServlet.doPost(AbstractHTTPServlet.java:209) javax.servlet.http.HttpServlet.service(HttpServlet.java:754) org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:265) org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83) org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76) com.paypal.api.utils.MultiReadServletFilter.doFilter(MultiReadServletFilter.java:23) com.paypal.foundation.service.rest.logging.StandardOuterTransactionCALFilter.doFilter(StandardOuterTransactionCALFilter.java:95) org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346) org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259) com.paypal.common.resource.filter.SecurityContextFilter.doFilter(SecurityContextFilter.java:75)</pre></p><p><b>note</b> <u>The full stack trace of the root cause is available in the JBoss Web/7.0.17.Final logs.</u></p><HR size="1" noshade="noshade"><h3>JBoss Web/7.0.17.Final</h3></body></html>
at com.paypal.base.HttpConnection.executeWithStream(HttpConnection.java:162)
at com.paypal.base.HttpConnection.execute(HttpConnection.java:65)
at com.paypal.base.rest.PayPalResource.execute(PayPalResource.java:417)
... 45 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: https://api.sandbox.paypal.com/v1/payments/payment/706473799bd24b5792e463df41140a61/execute
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1890)
at sun.net.www.protocol.http.HttpURLConnection$10.run(HttpURLConnection.java:1885)
at java.security.AccessController.doPrivileged(Native Method)
at sun.net.www.protocol.http.HttpURLConnection.getChainedException(HttpURLConnection.java:1884)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1457)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getInputStream(HttpsURLConnectionImpl.java:254)
at com.paypal.base.HttpConnection.executeWithStream(HttpConnection.java:132)
... 47 more
Caused by: java.io.IOException: Server returned HTTP response code: 500 for URL: https://api.sandbox.paypal.com/v1/payments/payment/706473799bd24b5792e463df41140a61/execute
at sun.net.www.protocol.http.HttpURLConnection.getInputStream0(HttpURLConnection.java:1840)
at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1441)
at java.net.HttpURLConnection.getResponseCode(HttpURLConnection.java:480)
at sun.net.www.protocol.https.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:338)
at com.paypal.base.HttpConnection.executeWithStream(HttpConnection.java:117)
... 47 more
我无法弄清楚什么是错的。 Paypal-Java-SDK或我的服务器端代码中是否存在任何问题。我做错了吗?
答案 0 :(得分:0)
此错误是由于错误的付款ID。我只是将代码更改为
if (request.getParameter("paymentId") != null) {
payment.setId(request.getParameter("paymentId"));
}
我认为Paypal应该处理这种错误并在Response JSON中显示一些正确的错误消息,例如缺少付款ID,无效的付款ID或其他内容。获得500内部服务器错误很奇怪,而且调试非常困难。