连接到Dynamodb时出现AWS lambda错误

时间:2017-05-10 15:11:28

标签: java lambda amazon-dynamodb aws-lambda amazon-kinesis

连接到动力学消费者的dynamodb时出现内存不足错误。

public void recordHandler(KinesisEvent event) throws IOException {
        System.out.println("Entering record Handler");
        try {
            AmazonDynamoDB client = new AmazonDynamoDBClient();
            client.setRegion(Region.getRegion(Regions.US_WEST_2));
            DynamoDB dynamoDB = new DynamoDB(client);
            Table table = dynamoDB.getTable("feeds");
            System.out.println("Event records size" + event.getRecords().size());
        for(KinesisEventRecord rec : event.getRecords()) {

//put item to table. 
}

任何人都可以指出我可能做错了什么。此外,我在lambda和kinesis流的同一区域有发电机表。

错误:

Metaspace: java.lang.OutOfMemoryError
java.lang.OutOfMemoryError: Metaspace
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at com.amazonaws.services.dynamodbv2.document.DynamoDB.getTable(DynamoDB.java:89)

0 个答案:

没有答案