Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dynamodb local setup on M1 apple silicon mac

I did a local setup of dynamodb using https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html

I am able to start the instance using the following command java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb but when i try to do anything else it gives me the following error.

Mar 15, 2021 2:10:28 PM com.almworks.sqlite4java.Internal log WARNING: [sqlite] cannot open DB[15]: com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: /Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: dlopen(/Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib, 1): no suitable image found. Did find: /Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: no matching architecture in universal wrapper /Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: no matching architecture in universal wrapper Mar 15, 2021 2:10:28 PM com.almworks.sqlite4java.Internal log SEVERE: [sqlite] SQLiteQueue[shared-local-instance.db]: error running job queue com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: /Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: dlopen(/Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib, 1): no suitable image found. Did find: /Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: no matching architecture in universal wrapper /Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: no matching architecture in universal wrapper at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:97) at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1441) at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:282) at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:293) at com.almworks.sqlite4java.SQLiteQueue.openConnection(SQLiteQueue.java:464) at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:641) at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623) at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77) at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205) at java.base/java.lang.Thread.run(Unknown Source) Caused by: java.lang.UnsatisfiedLinkError: /Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: dlopen(/Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib, 1): no suitable image found. Did find: /Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: no matching architecture in universal wrapper /Users/ahsanejaz/Downloads/dynamodb_local_latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: no matching architecture in universal wrapper at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method) at java.base/java.lang.ClassLoader$NativeLibrary.load(Unknown Source) at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(Unknown Source) at java.base/java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.base/java.lang.ClassLoader.loadLibrary(Unknown Source) at java.base/java.lang.Runtime.load0(Unknown Source) at java.base/java.lang.System.load(Unknown Source) at com.almworks.sqlite4java.Internal.tryLoadFromPath(Internal.java:340) at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:117) at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:95) ... 9 more Mar 15, 2021 2:10:28 PM com.almworks.sqlite4java.Internal log WARNING: [sqlite] SQLiteQueue[shared-local-instance.db]: stopped abnormally, reincarnating in 3000ms

Is this issure related to new M1 Apple Silicon architecture? Any workaround for this?

like image 797
Ahsan Ejaz Avatar asked Mar 15 '21 09:03

Ahsan Ejaz


People also ask

How do I connect to DynamoDB locally?

To access DynamoDB running locally, use the --endpoint-url parameter. The following is an example of using the AWS CLI to list the tables in DynamoDB on your computer. The AWS CLI can't use the downloadable version of DynamoDB as a default endpoint. Therefore, you must specify --endpoint-url with each AWS CLI command.

Can I install DynamoDB locally?

DynamoDB Local is available as a download (requires JRE), as an Apache Maven dependency, or as a Docker image. If you prefer to use the Amazon DynamoDB web service instead, see Setting up DynamoDB (web service).

How do I deploy my application to production with DynamoDB?

When you're ready to deploy your application in production, you remove the local endpoint in the code, and then it points to the DynamoDB web service. Having this local version helps you save on throughput, data storage, and data transfer fees.

How to download VM on M1 with Apple Silicon?

The steps to download VM on M1 with Apple Silicon are as follows: Step 1: If you are having M1 Apple Silicon and you want to install other operating systems on your Mac using a virtual machine then you can download UTM. Step 2: After downloading UTM you will see the file named UTM.dmg on your Mac and click on it.

Does Appium work on the Apple Silicon M1 SoC?

In this concise guide we will walkthrough the steps and considerations when setting up Appium on an Apple Silicon M1 Mac. The Apple Silicon M1 SoC in the recent Mac lineup is impressive with respect to its CPU performance and power efficiency.

Do I need an internet connection to use DynamoDB?

In addition, you don't need an internet connection while you develop your application. DynamoDB Local is available as a download (requires JRE), as an Apache Maven dependency, or as a Docker image. If you prefer to use the Amazon DynamoDB web service instead, see Setting Up DynamoDB (Web Service).


4 Answers

I was able to run DynamoDB installing a java version x86-64 architecture rather than arm64 and starting it up from a rosetta terminal

java --version 
openjdk 16.0.1 2021-04-20
OpenJDK Runtime Environment Zulu16.30+15-CA (build 16.0.1+9)
OpenJDK 64-Bit Server VM Zulu16.30+15-CA (build 16.0.1+9, mixed mode, sharing)

https://www.azul.com/downloads/zulu-community/?version=java-16-sts&os=macos&architecture=x86-64-bit&package=jre

like image 180
Leonardo Ampuero Avatar answered Oct 20 '22 01:10

Leonardo Ampuero


You can use newly published Apple Silicon (M1) library. Adding this as a dependency into your project or if you are using a folder based approach copying this file into native libraries path should fix the error:

io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392

Direct download link: https://repo1.maven.org/maven2/io/github/ganadist/sqlite4java/libsqlite4java-osx-aarch64/1.0.392/libsqlite4java-osx-aarch64-1.0.392.dylib

You can specify custom native library path with sqlite4java.library.path system property:

# JVM parameter:
-Dsqlite4java.library.path=./native-libs
# or within source code:
System.setProperty("sqlite4java.library.path", "./native-libs")
like image 9
veysiertekin Avatar answered Oct 20 '22 01:10

veysiertekin


I had the same issue with dynamodb-local installed via brew. Apparently the sqlite4java lib being used does not have an arm version in there. Eg i get:

Caused by: java.lang.UnsatisfiedLinkError: /opt/homebrew/Caskroom/dynamodb-local/latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: dlopen(/opt/homebrew/Caskroom/dynamodb-local/latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib, 1): no suitable image found.  Did find:
    /opt/homebrew/Caskroom/dynamodb-local/latest/DynamoDBLocal_lib/libsqlite4java-osx.dylib: no matching architecture in universal wrapper

Interestingly the docker image is working fine for me using the docker preview version, eg by using the docker compose file from Deploying DynamoDB Locally on Your Computer (on the Docker tab).

like image 3
Sidney Beekhoven Avatar answered Oct 20 '22 00:10

Sidney Beekhoven


When using Maven, simply add the following dependency:

<dependency>
  <groupId>io.github.ganadist.sqlite4java</groupId>
  <artifactId>libsqlite4java-osx-aarch64</artifactId>
  <version>1.0.392</version>
  <type>dylib</type>
  <scope>test</scope>
</dependency>

Note that com.almworks.sqlite4java has not been updated since 2014 so hopefully this will last until the AWS team will switch to another implementation.

like image 1
Ben Romberg Avatar answered Oct 19 '22 23:10

Ben Romberg