我正在eclipse中开发crm struts web应用程序。出于邮件目的,我创建了mailchimp帐户和mandrill集成。我找到了第三方包装器api(cribbstechnologies-Java-Mandrill-Wrapper)。从main方法执行时,它会给出如下的异常。我在MandrillHTMLMessage对象中提供了当前的API代码,所有邮件信息。
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)
如何解决异常。我在谷歌尝试但没有找到结果。
请有人帮助我......
提前致谢...
答案 0 :(得分: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