创建条纹电荷时出现NoSuchMethodError

时间:2019-04-28 19:24:10

标签: java maven gson stripe-payments

当尝试使用测试条带凭据充值时遇到问题,当调用该函数(托管在AWS Lambda上)时,返回以下异常。

到目前为止,我已经多次清洁/重建了该项目。经过一些研究,我偶然发现了issue这个指向Gson的罪魁祸首,但是Gson并不是一个依赖项,我什至在没有运气的情况下导入最新版本。

收费

library(tidyverse)
NightShifts %>% 
   extract(time, into = c("time1", "time2"), 
         "^t(\\d+)_(\\d+)_.*", remove = FALSE) %>%
   mutate_at(vars(time1, time2), as.POSIXct, format = "%H%M") %>% 
   mutate(Diff = as.numeric(difftime(time2, time1, unit = "min") + 
            `Sunday NightShifts`))

错误日志

@Override
    public String handleRequest(RequestClass requestClass, Context context) {

        Stripe.apiKey = "HIDDEN";

        try {

            Map<String, Object> chargeParams = new HashMap<String, Object>();
            chargeParams.put("amount", 2000);
            chargeParams.put("currency", "usd");
            chargeParams.put("description", "Charge for jenny.rosen@example.com");
            chargeParams.put("source", "tok_mastercard");

            Charge.create(chargeParams); //Exception points to this line

        } catch (StripeException e) {
            e.printStackTrace();
            System.out.println("Error: " + e.getMessage());
        }

        return "--";
    }

依赖项

(在有和没有Gson依赖的情况下都尝试过)

{
  "errorMessage": "com.google.gson.Gson.getDelegateAdapter(Lcom/google/gson/TypeAdapterFactory;Lcom/google/gson/reflect/TypeToken;)Lcom/google/gson/TypeAdapter;",
  "errorType": "java.lang.NoSuchMethodError",
  "stackTrace": [
    "com.stripe.model.BalanceTransactionSourceTypeAdapterFactory.create(BalanceTransactionSourceTypeAdapterFactory.java:32)",
    "com.google.gson.Gson.getAdapter(Gson.java:353)",
    "com.google.gson.Gson.fromJson(Gson.java:754)",
    "com.google.gson.Gson.fromJson(Gson.java:721)",
    "com.google.gson.Gson.fromJson(Gson.java:670)",
    "com.google.gson.Gson.fromJson(Gson.java:642)",
    "com.stripe.net.LiveStripeResponseGetter.staticRequest(LiveStripeResponseGetter.java:538)",
    "com.stripe.net.LiveStripeResponseGetter.request(LiveStripeResponseGetter.java:81)",
    "com.stripe.net.ApiResource.request(ApiResource.java:190)",
    "com.stripe.model.Charge.create(Charge.java:579)",
    "com.stripe.model.Charge.create(Charge.java:567)",
    "helloworld.AddCRM.handleRequest(AddCRM.java:33)",
    "helloworld.AddCRM.handleRequest(AddCRM.java:16)"
  ]
}

0 个答案:

没有答案