我有一堂课
SELECT *
FROM wp_users LEFT JOIN wp_usermeta
ON wp_users.ID = wp_usermeta.user_id
AND wp_usermeta.meta_key = 'metakey1'
WHERE wp_usermeta.user_id IS NULL
我在这里点击一个API端点:
package com.clevergift.services.payment;
import com.github.woki.payments.adyen.model.*;
import com.google.gson.annotations.SerializedName;
import javax.xml.bind.annotation.XmlRootElement;
import java.util.HashMap;
import java.util.Map;
@XmlRootElement
public class CGPaymentRequest {
@SerializedName("amount")
private Amount amount;
@SerializedName("merchantAccount")
private String merchantAccount;
@SerializedName("reference")
private String reference;
@SerializedName("additionalData")
private Map<String, String> additionalData = new HashMap<>();
// THIS IS SUPPOSED TO SOLVE THE PROBLEM
public CGPaymentRequest() {
}
public void setAdditionalData(Map<String, String> additionalData) {
this.additionalData = additionalData;
}
public Map<String, String> getAdditionalData() {
return additionalData;
}
public void setReference(String reference) {
this.reference = reference;
}
public String getReference() {
return reference;
}
public void setMerchantAccount(String merchantAccount) {
this.merchantAccount = merchantAccount;
}
public String getMerchantAccount() {
return merchantAccount;
}
public void setAmount(Amount amount) {
this.amount = amount;
}
public Amount getAmount() {
return amount;
}
}
这在本地绝对正常。
在我的build.gradle文件中,我有:
Client client = ClientBuilder.newClient();
WebTarget webTarget
= client.target(TESTING_PAYS_URL + "authorise");
Invocation.Builder invocationBuilder
= webTarget.request(APPLICATION_JSON_TYPE);
PaymentResponse paymentResponse = invocationBuilder
.post(Entity.entity(cgPaymentRequest, MediaType.APPLICATION_JSON), PaymentResponse.class);
很奇怪,当我在AWS Elastic Beanstalk上运行它时,出现错误:
// https://mvnrepository.com/artifact/org.glassfish.jersey.core/jersey-client
compile group: 'org.glassfish.jersey.core', name: 'jersey-client', version: '2.6'
我尝试了此解决方案(添加一个空的构造函数)https://stackoverflow.com/a/33756603/1246159。但是仍然会出现相同的错误。
我还尝试添加:
org.glassfish.jersey.message.internal.WriterInterceptorExecutor: MessageBodyWriter not found for media type=application/json, type=class com.clevergift.services.payment.CGPaymentRequest, genericType=class com.clevergift.services.payment.CGPaymentRequest.
但是仍然出现相同的错误。我不太确定接下来可以尝试什么......