14

History: I was able to get read/write to my local DynamoDB environment. I followed the AWS Documents for Downloading and Running DynamoDB: http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html

Issue: I had an accidental power outage to my computer. Now, I get the following error after I launch the DynamoDB process

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

Error Message:

Aug 23, 2017 3:52:42 PM com.almworks.sqlite4java.Internal log
WARNING: [sqlite] SQLiteQueue[shared-local-instance.db]: stopped abnormally, reincarnating in 3000ms
Aug 23, 2017 3:52:45 PM com.almworks.sqlite4java.Internal log
WARNING: [sqlite] cannot open DB[2]: com.almworks.sqlite4java.SQLiteException: [14] unable to open database file
Aug 23, 2017 3:52:45 PM com.almworks.sqlite4java.Internal log
SEVERE: [sqlite] SQLiteQueue[shared-local-instance.db]: error running job queue
com.almworks.sqlite4java.SQLiteException: [14] unable to open database file
    at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1480)
    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.lang.Thread.run(Thread.java:748)

Attempts: This post is the closest to my error but it involves not DynamoDB but some Cloud logs, etc: https://forums.aws.amazon.com/thread.jspa?threadID=165134

Any thoughts on how to rectify the database file?

Matt Gaunt
  • 9,434
  • 3
  • 36
  • 57
Jordan Lee
  • 515
  • 1
  • 5
  • 16
  • You might try opening it with the `sqlite3` command line utility, to see if there are more useful errors. – Michael - sqlbot Aug 24 '17 at 02:27
  • This error can also append on M1 Mac. If you're concerned, you can find a solution here: https://stackoverflow.com/questions/66635424/dynamodb-local-setup-on-m1-apple-silicon-mac – TimothePearce Jun 10 '21 at 09:17

9 Answers9

23

It could be a permission issue. try updating permissions.

sudo chown $USER docker -R
chmod 775 -R docker
Matt Gaunt
  • 9,434
  • 3
  • 36
  • 57
Zudhin
  • 266
  • 2
  • 5
12

It is indeed a permission issue as suggested by Zudhin https://stackoverflow.com/a/53132375/239613

In my case, I'm running Ubuntu and the quick and dirty solution I found is just changing the permissions of the local folder for the volume:

sudo chmod 777 ./docker/dynamodb (provided that's your local folder after following https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html)

Gastón Fournier
  • 956
  • 1
  • 9
  • 25
  • Has anyone been able to get this working with podman / podman-compose? I'm getting the same error and this worked for docker, but it's not working for podman. – Matt Gaunt Dec 09 '22 at 03:43
4

Best way for me using the docker dynamodb-local image was to change the user to root, here is my partial docker-compose.yml file:

version: '3.8'

services:
  dynamodb-local:
    image: amazon/dynamodb-local:latest
    container_name: dynamodb-local
    restart: unless-stopped
    ports:
      - "8000:8000"
    user: root
    volumes:
      - ../tmp/dynamodb:/home/dynamodblocal/data
    working_dir: /home/dynamodblocal
    command: "-jar DynamoDBLocal.jar -sharedDb -dbPath ./data"
Y. E.
  • 687
  • 1
  • 10
  • 29
workpush
  • 41
  • 3
2

I had faced a similar error with Docker on Windows and the solution was to give 'System' all the permissions for the Docker Volume which persisted the DB Data

Rohan Sawant
  • 938
  • 1
  • 11
  • 18
1

Quick solution was to reinstall everything.

rm -rf <unzipped DynamoDB Local folder>

Then, go back through the installation instructions. http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html

I'm unfamiliar with jar files. Replacing them with new jar files is like reinstalling?

Jordan Lee
  • 515
  • 1
  • 5
  • 16
1

If you are on Windows, start the command prompt in administrator mode and then run your command again.

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

It worked for me.

1

In docker like environment . Same permission issue. sudo chmod 777 ./docker/dynamodb .This still works in 2022

Safayet Jamil
  • 509
  • 3
  • 5
0

I got this error when I upgraded my MacOS to Catalina.

I installed DynamoDBLocal again via these instructions - https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html

and it then worked.

If you need to have your old data replicated, just copy the existing "shared-local-instance.db" file into your new installation and it will work as before.

This is caused most likely to some permission changes to file access after Catalina was put in.

newbreedofgeek
  • 3,106
  • 1
  • 19
  • 17
0

If you are on Windows, give writing rights to the DynamoDB folder in your Desktop.

Gabriel
  • 67
  • 9