gpt4 book ai didi

java - 山魈包装 API JAVA

转载 作者:行者123 更新时间:2023-11-30 04:39:38 28 4
gpt4 key购买 nike

我正在 eclipse 中开发 crm struts Web 应用程序。为了邮寄目的,我创建了 mailchimp 帐户和 mandrill 集成。我找到了第三方包装 API (cribbstechnologies-Java-Mandrill-Wrapper)。从 main 方法执行时,它给出如下异常。我提供了当前的API代码,MandrillHTMLMessage对象中的所有邮件信息。

private BaseMandrillResponse performPostRequest(BaseMandrillRequest request, String serviceMethod, Object responseClass, TypeReference reference) throws RequestFailedException {
try {
System.out.println("PostRequest Starts");
request.setKey(config.getApiKey());
HttpPost postRequest = new HttpPost(config.getServiceUrl() + serviceMethod);
String postData = getPostData(request);

............

protected String getPostData(BaseMandrillRequest request) throws JsonGenerationException, JsonMappingException, IOException {
return objectMapper.writeValueAsString(request);
}

objectMapper.writeValueAsString(request) 处出现异常;如下所示的行

Exception in thread "main" java.lang.IllegalAccessError: tried to access method org.codehaus.jackson.JsonFactory._getBufferRecycler()Lorg/codehaus/jackson/util/BufferRecycler; from class org.codehaus.jackson.map.ObjectMapper
at org.codehaus.jackson.map.ObjectMapper.writeValueAsString(ObjectMapper.java:1030)
at com.cribbstechnologies.clients.mandrill.request.MandrillRESTRequest.getPostData(MandrillRESTRequest.java:102)
at com.cribbstechnologies.clients.mandrill.request.MandrillRESTRequest.performPostRequest(MandrillRESTRequest.java:47)
at com.cribbstechnologies.clients.mandrill.request.MandrillRESTRequest.postRequest(MandrillRESTRequest.java:38)
at com.cribbstechnologies.clients.mandrill.request.MandrillMessagesRequest.sendMessage(MandrillMessagesRequest.java:33)
at com.cribbstechnologies.clients.mandrill.it.MessagesTest.testSendMessage(MessagesTest.java:86)
at com.cribbstechnologies.clients.mandrill.it.MessagesTest.before(MessagesTest.java:63)
at com.cribbstechnologies.clients.mandrill.it.MessagesTest.beforeClass(MessagesTest.java:56)
at com.cribbstechnologies.clients.mandrill.it.SendMail.main(SendMail.java:9)

如何解决异常。我在谷歌中尝试过,但没有找到结果。

请大家帮帮我...

提前致谢...

最佳答案

您是否尝试过在 Github 上联系作者? https://github.com/cribbstechnologies/Java-Mandrill-Wrapper

如果图书馆出现问题,我会直接向他们提出问题。我没有从您在此处发布的内容中获得足够的上下文来直接对其进行故障排除。

如果有任何混淆,还有一些集成测试可能有助于阐明用法: https://github.com/cribbstechnologies/Java-Mandrill-Wrapper/blob/master/src/test/java/com/cribbstechnologies/clients/mandrill/request/MandrillUsersRequestTest.java

关于java - 山魈包装 API JAVA,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12624106/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com