执行DynamoDB,码头异常错误

时间:2018-06-19 18:50:00

标签: node.js amazon-web-services ubuntu amazon-dynamodb

所以我安装了dynamoDB的本地版本 https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html

然后,在同一链接中提到了已执行的命令

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

问题是我每次都会收到此错误

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)

我如何摆脱这个问题?

使用Ubuntu 16.04,尝试使dynamoDB适用于nodeJS

1 个答案:

答案 0 :(得分:0)

如果您正在使用它进行本地开发,我强烈建议对dynamoDB使用docker映像-这样可以确保您不需要在Linux风格上进行特定配置,并且应该开箱即用。

对我来说,https://hub.docker.com/r/dwmkerr/dynamodb/在我的用例中表现很好。如果您还没有docker,这是有关如何为Ubuntu 16.04安装它的便捷指南-https://www.digitalocean.com/community/tutorials/how-to-install-and-use-docker-on-ubuntu-16-04