Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to use AmazonDynamoDB Local?

How do i make user of AmazonDynamoDB Local work for me. In spite of providing all the configuration information i get error on server side and client timeouts.


Server


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 [email protected]: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)

Caused by: java.lang.UnsatisfiedLinkError: no sqlite4java-win32-x86 in java.library.path at 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 more

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

Client


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);
    }
}
like image 770
Navap Avatar asked Oct 09 '13 00:10

Navap


People also ask

Can you use DynamoDB locally?

DynamoDB Local is available as a download (requires JRE), as an Apache Maven dependency, or as a Docker image. If you prefer to use the Amazon DynamoDB web service instead, see Setting up DynamoDB (web service).

How do I access DynamoDB locally?

To access DynamoDB running locally, use the --endpoint-url parameter. The following is an example of using the AWS CLI to list the tables in DynamoDB on your computer. The AWS CLI can't use the downloadable version of DynamoDB as a default endpoint. Therefore, you must specify --endpoint-url with each AWS CLI command.

How do I create a DynamoDB table in local?

To create a new Music table using the DynamoDB console: Sign in to the AWS Management Console and open the DynamoDB console at https://console.aws.amazon.com/dynamodb/ . In the navigation pane on the left side of the console, choose Dashboard. On the right side of the console, choose Create Table.

How do I access Amazon DynamoDB?

You can access Amazon DynamoDB using the AWS Management Console, the AWS Command Line Interface (AWS CLI), or the DynamoDB API. To use the Amazon Web Services Documentation, Javascript must be enabled. Please refer to your browser's Help pages for instructions.


1 Answers

You need to run the java command so that -Djava.library.path refers to the path under which you extracted the Local DynamoDB package. The . in -Djava.library.path=. means "the current directory", and the app needs to be able to load the native SQLite libraries in the Local DynamoDB directory.

So you can either run this command from within the local DynamoDB directory:

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

or you have to give the full path to both:

java -Djava.library.path=c:\path\to\dynamodb\ -jar c:\path\to\dynamodb\DynamoDBLocal.jar
like image 162
matt b Avatar answered Oct 02 '22 20:10

matt b