title: How to use a saved DynamoDBLocal.jar in dynamodb-local docker instance
body: <p>I'm using the Amazon local dynamodb docker image for local development: <a href="https://hub.docker.com/r/amazon/dynamodb-local/" rel="nofollow noreferrer">https://hub.docker.com/r/amazon/dynamodb-local/</a> However, when it starts, it starts with an empty database.</p>
  
  <p>I want to use a saved <code>./database/DynamoDBLocal.jar</code> in the container, however, I'm unsure and unable to use it.</p>
  
  <p>in docker-compose.yml:</p>
  
  <pre><code>db:
  image: "amazon/dynamodb-local"
  ports:
      - "8000:8000"
  volumes:
    - ./database:/database
  </code></pre>
  
  <p>I've tried to run the application command from inside the container:</p>
  
  <pre><code>$ docker-compose exec db /bin/sh
  </code></pre>
  
  <p>Then I attempt to run the java command:</p>
  
  <pre><code>/bin/java -Djava.library.path=./DynamoDBLocal_lib -jar /database/DynamoDBLocal.jar -sharedDb -port 8887
  </code></pre>
  
  <p>And this error:</p>
  
  <pre><code>Error: A JNI error has occurred, please check your installation and try again
  Exception in thread "main" java.lang.NoClassDefFoundError: org/eclipse/jetty/server/handler/AbstractHandler
  at java.lang.ClassLoader.defineClass1(Native Method)
  at java.lang.ClassLoader.defineClass(ClassLoader.java:763)
  at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
  at java.net.URLClassLoader.defineClass(URLClassLoader.java:467)
  at java.net.URLClassLoader.access$100(URLClassLoader.java:73)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:368)
  at java.net.URLClassLoader$1.run(URLClassLoader.java:362)
  at java.security.AccessController.doPrivileged(Native Method)
  at java.net.URLClassLoader.findClass(URLClassLoader.java:361)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  at java.lang.Class.getDeclaredMethods0(Native Method)
  at java.lang.Class.privateGetDeclaredMethods(Class.java:2701)
  at java.lang.Class.privateGetMethodRecursive(Class.java:3048)
  at java.lang.Class.getMethod0(Class.java:3018)
  at java.lang.Class.getMethod(Class.java:1784)
  at sun.launcher.LauncherHelper.validateMainClass(LauncherHelper.java:544)
  at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:526)
  Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.server.handler.AbstractHandler
  at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
  at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
  at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
  ... 19 more
  </code></pre>
  
  <p>Is there a better way to do this?</p>