7

我如何让 AmazonDynamoDB Local 的用户为我工作。尽管提供了所有配置信息,但我在服务器端和客户端超时时遇到错误。


服务器


C:\Program Files (x86)\Java\jre7\bin>java -Djava.library.path=. -jar C:\Users\XXX\XXX\DynamoDB\dynamodb_loca
l_2013-09-12\DynamoDBLocal.jar --port 8888
2013-10-09 11:15:44.346:INFO:oejs.Server:jetty-8.y.z-SNAPSHOT
2013-10-09 11:15:44.413:INFO:oejs.AbstractConnector:Started SelectChannelConnector@0.0.0.0:8888
Oct 09, 2013 11:15:55 AM com.almworks.sqlite4java.Internal log
INFO: [sqlite] DB[1]: instantiated [XXXXXXXXXXXXXXXXX_us-east-1.db]
Oct 09, 2013 11:15:55 AM com.almworks.sqlite4java.Internal log
WARNING: [sqlite] cannot open DB[1]: com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.Unsa
tisfiedLinkError: no sqlite4java-win32-x86 in java.library.path
Oct 09, 2013 11:15:55 AM com.almworks.sqlite4java.Internal log
SEVERE: [sqlite] SQLiteQueue[AKIAIZR4RBNLFYSQQKAQ_us-east-1.db]: error running job queue
com.almworks.sqlite4java.SQLiteException: [-91] cannot load library: java.lang.UnsatisfiedLinkError: no sqlite4java-win3
2-x86 in java.library.path
at com.almworks.sqlite4java.SQLite.loadLibrary(SQLite.java:97)
at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1314)
at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:258)
at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:269)
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(Unknown Source)

原因:java.lang.UnsatisfiedLinkError: no sqlite4java-win32-x86 in java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang. System.loadLibrary(Unknown Source) at com.almworks.sqlite4java.Internal.tryLoadFromSystemPath(Internal.java:349) at com.almworks.sqlite4java.Internal.loadLibraryX(Internal.java:124) at com.almworks.sqlite4java.SQLite。 loadLibrary(SQLite.java:95) ... 还有 9 个

Oct 09, 2013 11:15:55 AM com.almworks.sqlite4java.Internal log
WARNING: [sqlite] SQLiteQueue[XXXXXXXXXXXXXXXX_us-east-1.db]: stopped abnormally, reincarnating in 3000ms

客户


class Program
{
    private static AmazonDynamoDBClient client;

    static void Main(string[] args)
    {
        CreateClient();

        CreateTablesUploadSampleItems(client);
    }

    private static void CreateClient()
    {
        var config = new AmazonDynamoDBConfig();
        config.ServiceURL = System.Configuration.ConfigurationManager.AppSettings["ServiceURL"];
        var accessKey = System.Configuration.ConfigurationManager.AppSettings["AWSAccessKey"];
        var secretAccessKey = System.Configuration.ConfigurationManager.AppSettings["AWSSecretKey"];
        client = new AmazonDynamoDBClient(accessKey, secretAccessKey, config);
    }
}
4

3 回答 3

4

您需要运行 java 命令,以便-Djava.library.path引用您提取本地 DynamoDB 包的路径。.in表示“-Djava.library.path=.当前目录”,应用程序需要能够加载本地 DynamoDB 目录中的原生 SQLite 库。

因此,您可以从本地 DynamoDB 目录中运行此命令:

java -Djava.library.path=. -jar DynamoDBLocal.jar

或者您必须提供两者的完整路径:

java -Djava.library.path=c:\path\to\dynamodb\ -jar c:\path\to\dynamodb\DynamoDBLocal.jar
于 2013-10-16T15:49:35.487 回答
0

试试这个 Maven 插件,它为你做了这一切:http ://www.jcabi.com/jcabi-dynamodb-maven-plugin/index.html

于 2013-10-11T06:15:16.030 回答
0

我知道这是一个旧请求,但从那时起我开始使用其他解决方案,例如 localstack。我建议工程师使用localstack。它可以通过调用 docker 来运行!

于 2020-03-27T14:33:42.920 回答