Skip to content
This repository has been archived by the owner on Jun 15, 2022. It is now read-only.

1. Fixed error: java.lang.NoSuchMethodError: com.amazonaws.services.c… #35

Closed
wants to merge 1 commit into from

Conversation

pir-dsl
Copy link

@pir-dsl pir-dsl commented Sep 14, 2016

  1. Fixed error: java.lang.NoSuchMethodError: com.amazonaws.services.cloudwatch.AmazonCloudWatch.putMetricData;
  2. Fixed compilation error caused by obsolete dependencies in aws java sdk by using more recent dependencies;
  3. Added items from IDEA to .gitignore file.

…loudwatch.AmazonCloudWatch.putMetricData;

2. Fixed compilation error caused by obsolete dependencies in aws java sdk by using more recent dependencies;
3. Added items from IDEA to .gitignore file.
@anmolnar
Copy link

This is a pretty important fix for CloudWatch monitoring. Would you please merge it?

@pir-dsl
Copy link
Author

pir-dsl commented Feb 10, 2017

Hey dolphy17, glad you feel this is useful. However, I am not the owner or developer of dynamodb-cross-region-library project. and don't have the option to merge it. I don't know why nobody watch these pull requests... For now, I guess you may just copy and past to use it...

@snkinard
Copy link

Thanks for this fix, @pir-dsl.

FYI I am seeing this error in connectors.log when using this fork. It may result in data loss during replication:

2017-02-16 14:21:12,366 INFO   com.amazonaws.protocol.json.JsonContent - Unable to parse HTTP response content
com.fasterxml.jackson.core.JsonParseException: Unexpected character ('<' (code 60)): expected a valid value (number, String, array, object, 'true', 'false' or 'null')
 at [Source: [B@51ed0fae; line: 1, column: 2]
	at com.fasterxml.jackson.core.JsonParser._constructError(JsonParser.java:1702)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportError(ParserMinimalBase.java:558)
	at com.fasterxml.jackson.core.base.ParserMinimalBase._reportUnexpectedChar(ParserMinimalBase.java:456)
	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._handleUnexpectedValue(UTF8StreamJsonParser.java:2685)
	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser._nextTokenNotInObject(UTF8StreamJsonParser.java:878)
	at com.fasterxml.jackson.core.json.UTF8StreamJsonParser.nextToken(UTF8StreamJsonParser.java:772)
	at com.fasterxml.jackson.databind.ObjectMapper._initForReading(ObjectMapper.java:3825)
	at com.fasterxml.jackson.databind.ObjectMapper._readMapAndClose(ObjectMapper.java:3774)
	at com.fasterxml.jackson.databind.ObjectMapper.readTree(ObjectMapper.java:2395)
	at com.amazonaws.protocol.json.JsonContent.parseJsonContent(JsonContent.java:65)
	at com.amazonaws.protocol.json.JsonContent.<init>(JsonContent.java:57)
	at com.amazonaws.protocol.json.JsonContent.createJsonContent(JsonContent.java:52)
	at com.amazonaws.http.JsonErrorResponseHandler.handle(JsonErrorResponseHandler.java:61)
	at com.amazonaws.http.JsonErrorResponseHandler.handle(JsonErrorResponseHandler.java:33)
	at com.amazonaws.http.AmazonHttpClient.handleErrorResponse(AmazonHttpClient.java:1310)
	at com.amazonaws.http.AmazonHttpClient.executeOneRequest(AmazonHttpClient.java:959)
	at com.amazonaws.http.AmazonHttpClient.executeHelper(AmazonHttpClient.java:736)
	at com.amazonaws.http.AmazonHttpClient.doExecute(AmazonHttpClient.java:487)
	at com.amazonaws.http.AmazonHttpClient.executeWithTimer(AmazonHttpClient.java:448)
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:397)
	at com.amazonaws.http.AmazonHttpClient.execute(AmazonHttpClient.java:378)
	at com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreamsClient.doInvoke(AmazonDynamoDBStreamsClient.java:702)
	at com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreamsClient.invoke(AmazonDynamoDBStreamsClient.java:672)
	at com.amazonaws.services.dynamodbv2.AmazonDynamoDBStreamsClient.getRecords(AmazonDynamoDBStreamsClient.java:486)
	at com.amazonaws.services.dynamodbv2.streamsadapter.AmazonDynamoDBStreamsAdapterClient.getRecords(AmazonDynamoDBStreamsAdapterClient.java:481)
	at com.amazonaws.services.kinesis.clientlibrary.proxies.KinesisProxy.get(KinesisProxy.java:150)
	at com.amazonaws.services.kinesis.clientlibrary.proxies.MetricsCollectingKinesisProxyDecorator.get(MetricsCollectingKinesisProxyDecorator.java:73)
	at com.amazonaws.services.kinesis.clientlibrary.lib.worker.KinesisDataFetcher.getRecords(KinesisDataFetcher.java:67)
	at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.getRecordsResultAndRecordMillisBehindLatest(ProcessTask.java:284)
	at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.getRecordsResult(ProcessTask.java:249)
	at com.amazonaws.services.kinesis.clientlibrary.lib.worker.ProcessTask.call(ProcessTask.java:120)
	at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:49)
	at com.amazonaws.services.kinesis.clientlibrary.lib.worker.MetricsCollectingTaskDecorator.call(MetricsCollectingTaskDecorator.java:24)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

@nageswararao-boddu
Copy link

This fix worked for me locally.

@pir-dsl
Copy link
Author

pir-dsl commented Mar 17, 2017

@snkinard that error looks to me a pure data issue, see this line
at com.amazonaws.protocol.json.JsonContent.parseJsonContent(JsonContent.java:65)

as mentioned in the thread, json just takes number, String, array, object, 'true', 'false' or 'null' so a character like '<' is not going to be parsed correctly.

@grayaii
Copy link

grayaii commented Apr 13, 2017

I gotta say, this worked for me too. I can't quite find the metrics in cloudwatch, but that is most likely user error on my end...

Copy link
Contributor

@amcp amcp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

minor feedback

Copy link
Contributor

@amcp amcp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pressed the trigger too fast, here are the comments

@@ -81,6 +81,22 @@
<!-- Libraries -->
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you remove the jackson dependencies as you do not appear to use them in your code change below?

import com.amazonaws.services.dynamodbv2.model.Record;
import com.amazonaws.services.dynamodbv2.model.UpdateItemRequest;
import com.amazonaws.services.dynamodbv2.model.UpdateItemResult;
import com.amazonaws.services.dynamodbv2.model.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Catch-all imports may make the fat JAR bigger. Can you stick with the existing list of imported classes?

import java.util.Collections;
import java.util.Date;
import java.util.List;
import java.util.concurrent.*;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it seems like these import are not being used. can you remove them?

</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i am not sure why jackson-core is required?

</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is jackson-annotations necessary?

@@ -81,6 +81,22 @@
<!-- Libraries -->
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.2</version>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if jackson-* actually turn out to be necessary, please externalize this version number to a property like jackson.version

@amcp
Copy link
Contributor

amcp commented Apr 23, 2017

The bug fixed in this PR has been fixed in the latest release, 1.2.1. If you still have issues with CloudWatch monitoring, please open an issue.

@amcp amcp closed this Apr 23, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants