M1 苹果硅上的 Dynamodb 本地设置 mac
Dynamodb local setup on M1 apple silicon mac
在本地设置了 dynamodb
我可以使用以下命令启动实例 java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
但是当我尝试执行其他任何操作时,出现以下错误。
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[=12=]0(SQLiteQueue.java:77)
at com.almworks.sqlite4java.SQLiteQueue.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
此问题是否与新的 M1 Apple Silicon 架构有关?有什么解决方法吗?
我在通过 brew 安装的 dynamodb-local 上遇到了同样的问题。显然,正在使用的 sqlite4java 库中没有 arm 版本。例如我得到:
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
有趣的是,使用 docker preview version, eg by using the docker compose file from Deploying DynamoDB Locally on Your Computer(在 Docker 选项卡上),docker 图像对我来说效果很好。
我能够 运行 DynamoDB 安装 java 版本的 x86-64 架构而不是 arm64 并从 rosetta 终端启动它
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)
您可以使用新发布的 Apple Silicon (M1) 库。将此作为依赖项添加到您的项目中,或者如果您使用基于文件夹的方法将此文件复制到本机库路径中应该可以修复错误:
io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392
您可以使用 sqlite4java.library.path
系统指定自定义本机库路径 属性:
# JVM parameter:
-Dsqlite4java.library.path=./native-libs
# or within source code:
System.setProperty("sqlite4java.library.path", "./native-libs")
使用Maven时,只需添加如下依赖:
<dependency>
<groupId>io.github.ganadist.sqlite4java</groupId>
<artifactId>libsqlite4java-osx-aarch64</artifactId>
<version>1.0.392</version>
<type>dylib</type>
<scope>test</scope>
</dependency>
请注意,com.almworks.sqlite4java
自 2014 年以来就没有更新过,所以希望这会持续到 AWS 团队切换到另一个实现。
安装 docker 后可以:
docker pull amazon/dynamodb-local:latest
docker run -p 8000:8000 amazon/dynamodb-local:latest
另一种方法是使用 Docker 容器并将其绑定到您通常为 ARM 架构绑定的相同端口。
我可以使用以下命令启动实例 java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb
但是当我尝试执行其他任何操作时,出现以下错误。
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[=12=]0(SQLiteQueue.java:77) at com.almworks.sqlite4java.SQLiteQueue.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
此问题是否与新的 M1 Apple Silicon 架构有关?有什么解决方法吗?
我在通过 brew 安装的 dynamodb-local 上遇到了同样的问题。显然,正在使用的 sqlite4java 库中没有 arm 版本。例如我得到:
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
有趣的是,使用 docker preview version, eg by using the docker compose file from Deploying DynamoDB Locally on Your Computer(在 Docker 选项卡上),docker 图像对我来说效果很好。
我能够 运行 DynamoDB 安装 java 版本的 x86-64 架构而不是 arm64 并从 rosetta 终端启动它
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)
您可以使用新发布的 Apple Silicon (M1) 库。将此作为依赖项添加到您的项目中,或者如果您使用基于文件夹的方法将此文件复制到本机库路径中应该可以修复错误:
io.github.ganadist.sqlite4java:libsqlite4java-osx-aarch64:1.0.392
您可以使用 sqlite4java.library.path
系统指定自定义本机库路径 属性:
# JVM parameter:
-Dsqlite4java.library.path=./native-libs
# or within source code:
System.setProperty("sqlite4java.library.path", "./native-libs")
使用Maven时,只需添加如下依赖:
<dependency>
<groupId>io.github.ganadist.sqlite4java</groupId>
<artifactId>libsqlite4java-osx-aarch64</artifactId>
<version>1.0.392</version>
<type>dylib</type>
<scope>test</scope>
</dependency>
请注意,com.almworks.sqlite4java
自 2014 年以来就没有更新过,所以希望这会持续到 AWS 团队切换到另一个实现。
安装 docker 后可以:
docker pull amazon/dynamodb-local:latest
docker run -p 8000:8000 amazon/dynamodb-local:latest
另一种方法是使用 Docker 容器并将其绑定到您通常为 ARM 架构绑定的相同端口。