Package com amazonaws services lambda runtime showing does not exist in AWS java sdk 1 10 2

+3 votes

I have been trying to run the Java code example in the Getting Started (Authoring AWS Lambda Code in Java) in this page but I am stuck as com.amazonaws.services.lambda.runtime package looks like its missing.

Showing the sample code below:

package example;

import com.amazonaws.services.lambda.runtime.Context;      //package does not exist error
import com.amazonaws.services.lambda.runtime.LambdaLogger; // package does not exist error
import com.amazonaws.services.s3.AmazonS3;       // import works (not needed, I've put them in for testing import)
import com.amazonaws.services.s3.model.S3Object; // import works (not needed, I've put them in for testing import)

public class Hello {
    public String myHandler(int myCount, Context context) {
        LambdaLogger logger = context.getLogger();
        logger.log("received : " + myCount);
        return String.valueOf(myCount);
    }
}

I am facing the same error both in Netbeans and in command line even after mentioning the aws sdk thorugh -cp argument from the first 2 imports in the code below:

package com.amazonaws.services.lambda.runtime does not exist

While importing other packages from the SDK its working fine, as from the third and the fourth imports in the above code the s3 imports which I put in just to test. I am using version 1.10.2 aws-java-sdk-1.10.2.zip of the AWS Java SDK, downloaded from this website:  http://sdk-for-java.amazonwebservices.com/latest/aws-java-sdk.zip

All of your suggestions and helps are welcome! Thanks in Advance!

May 2, 2018 in AWS by Flying geek
• 3,280 points
5,462 views

3 answers to this question.

0 votes

Dude, you are trying to use java code sample from AWS LAMBDA website:https: THIS for another product Amazon AWS SDK For Java.

Please read AWS Lambda welcome-page and  then after those steps create account and others and you can download package with your classes including Context, LambdaLogger.

Cheers!

answered May 3, 2018 by Cloud gunner
• 4,670 points
0 votes

After some searching I found com.amazonaws.services.lambda.runtime.Context in http://mvnrepository.com/artifact/com.amazonaws/aws-lambda-java-core/1.1.0 . (I prefer this site to search.maven.org. mvnrepository.com gets right to the heart of my problem by supplying the sbt build line.)

The class is not in aws-java-sdk-lambda , nor is it in aws-java-sdk-core, or aws-java-sdk .

answered Aug 1, 2018 by bug_seeker
• 15,520 points
0 votes
  1. Add AWS plugins within eclipse from market place, make aws lambda project.
  2. Use below three dependencies to make fat jar.

    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-lambda</artifactId>
        <version>1.11.76</version>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-lambda-java-core</artifactId>
        <version>1.1.0</version>
    </dependency> 
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-lambda-java-events</artifactId>
        <version>1.3.0</version>
    </dependency>
answered Aug 23, 2018 by Priyaj
• 58,090 points

Related Questions In AWS

0 votes
0 answers
0 votes
0 answers

Java snapstart is not available in AWS Lambda

I have started to write Java Lambdas ...READ MORE

Jan 3, 2023 in AWS by Tejashwini
• 3,820 points
428 views
0 votes
1 answer

What does event represent in AWS Lambda?

The Events that are passed to Lambda function as ...READ MORE

answered Jan 25, 2019 in AWS by Esha

edited Jan 25, 2019 506 views
+2 votes
1 answer

Deploy Docker Containers from Docker Cloud

To solve this problem, I followed advice ...READ MORE

answered Sep 3, 2018 in AWS by Priyaj
• 58,090 points
2,467 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
3,503 views
+5 votes
2 answers

Can we export/migrate users from AWS cognito, does it cause vendor lock-in?

Cognito actually has the capability to import ...READ MORE

answered Aug 1, 2018 in AWS by bug_seeker
• 15,520 points
4,485 views
+1 vote
2 answers

How do I get my AWS Glue client in JAVA?

Hey, you've been using a correct code ...READ MORE

answered Apr 17, 2018 in AWS by Cloud gunner
• 4,670 points
4,424 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP