0

I would like to use Amazon Lambda to run a component. However, this component has dependencies with some packages which seem to be only available in the Oracle's SDK.

I have read that AWS Lambda functions run on Linux Amazon AMI (which are Open SDK based). Actually, some time ago I tried to run my project on an EC2 instance and faced the same problem, so I switched to a standard Ubuntu 14.04 and I installed the Oracle Java 8 SDK.

Do you have any ideas?

Edit: the problem I'm finding is:

[2016-11-21T23:58:02.100] java.lang.NoClassDefFoundError: com/sun/webkit/network/CookieManager
[2016-11-21T23:58:02.100] java.lang.NoClassDefFoundError: com/sun/webkit/network/CookieManager
[2016-11-21T23:58:02.100] at com.machinepublishers.jbrowserdriver.JBrowserDriverServer.main(JBrowserDriverServer.java:74)

I think that class is only available in the Oracle's Java SDK.

1
  • 1
    No...Please check: Pre-requisites There's no need to install any web browser and this works fine on a server (headless). Java 8 (Oracle JDK/JRE or OpenJDK) is required. Linux users: on Debian/Ubuntu install the following, apt-get install openjdk-8-jdk openjfx. Resource Link: libraries.io/maven/com.machinepublishers:jbrowserdriver Commented Nov 22, 2016 at 0:59

1 Answer 1

2

If you check Lambda Execution Environment and Available Libraries, then you will get

If you are using any native binaries in your code, make sure they are compiled in this environment. Note that only 64-bit binaries are supported on AWS Lambda.

AWS Lambda supports the following runtime versions:

  1. Node.js – v0.10.36, v4.3.2 (recommended)
  2. Java – Java 8
  3. Python – Python 2.7

Q: What is the JVM environment Lambda uses for execution of my function?

Ans: Lambda provides the Amazon Linux build of openjdk 1.8.

Q: How do I compile my AWS Lambda function Java code?

You can use standard tools like Maven or Gradle to compile your Lambda function. Your build process should mimic the same build process you would use to compile any Java code that depends on the AWS SDK. Run your Java compiler tool on your source files and include the AWS SDK 1.9 or later with transitive dependencies on your classpath. For more details, see aws documentation.

You can also check: AWS Lambda: How It Works

UPDATE:

If you check the github for jbrowserdriver, the pre-requisite are given

Prerequisites

Java 8 with JavaFX:

  • Ubuntu Xenial 16.04 LTS, Debian 8 Jessie (Backports), Debian 9 Stretch:

    sudo apt-get install openjdk-8-jre openjfx
    
  • Ubuntu Trusty 14.04 LTS:

    sudo add-apt-repository ppa:webupd8team/java && sudo apt-get update && sudo apt-get install oracle-java8-installer libgtk2.0 libxtst6 libxslt1.1 fonts-freefont-ttf libasound2 && sudo update-alternatives --config java
    
  • Mac, Windows, Linux:

    install Oracle Java 8 (note: choose either the JRE or JDK but not the "Server JRE" since it doesn't include JavaFX)

Resource Link:

  1. https://aws.amazon.com/lambda/faqs/#functions-java
Sign up to request clarification or add additional context in comments.

1 Comment

Thanks for your response, it seems that CookieManager is a part of openjfx (grepcode.com/file/repo1.maven.org/maven2/…). Then, the problem is not about opensdk/oracle issues but about the absence of a package in the Lambda environment, right? Then the response could be summarized like: "Oracle SDK is not supported in AWS Lambda, but regarding your particular issue, the problem apparently is caused because openjfx is not present".

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.