1

我正在 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)

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

请任何人帮助我...

提前致谢...

4

1 回答 1

2

您是否尝试过在 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

于 2012-09-28T15:27:40.573 回答