1
votes

titan version = 1.0.0 gremlin version = 3.0.1-incubating.

Running local DynamoDB in Ubuntu 16.04 terminal gives me an error like this...

[ERROR] Failed to execute goal on project dynamodb-titan100-storage-backend: Could not resolve dependencies for project com.amazonaws:dynamodb-titan100-storage-backend:jar:1.0.0: Failed to collect dependencies at com.amazonaws:DynamoDBLocal:jar:[1.0.0,2.0.0]: No versions available for com.amazonaws:DynamoDBLocal:jar:[1.0.0,2.0.0] within specified range -> [Help 1].

pom.xml file look like this

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.amazonaws</groupId>
<artifactId>dynamodb-titan100-storage-backend</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<name>Amazon DynamoDB Storage Backend for Titan</name>
<url>https://github.com/awslabs/dynamodb-titan-storage-backend</url>
<description>The Amazon DynamoDB Storage Backend for Titan: Distributed Graph Database allows Titan graphs to use DynamoDB as a storage backend.</description>
<scm>
    <url>[email protected]:awslabs/dynamodb-titan-storage-backend.git</url>
    <tag>titan1.0.0-1.0.0</tag>
</scm>
<properties>
    <test.extra.jvm.opts>-javaagent:${basedir}/target/jamm-${jamm.version}.jar </test.extra.jvm.opts>
    <default.test.jvm.opts>-Xms256m -Xmx1280m -XX:+HeapDumpOnOutOfMemoryError -ea ${test.extra.jvm.opts} </default.test.jvm.opts>
    <mem.jvm.opts>-Xms256m -Xmx768m -ea -XX:+HeapDumpOnOutOfMemoryError ${test.extra.jvm.opts} </mem.jvm.opts>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <dynamodb-local.port>4567</dynamodb-local.port>
    <dynamodb-local.endpoint>http://localhost:${dynamodb-local.port}</dynamodb-local.endpoint>
    <jdk.version>1.8</jdk.version>
    <aws.java.sdk.version>[1.0.0,2.0.0]</aws.java.sdk.version>
    <titan.version>1.0.0</titan.version>
    <tinkerpop.version>3.0.1-incubating</tinkerpop.version>
    <dependency.plugin.version>2.10</dependency.plugin.version>
    <maven.assembly.plugin.version>2.5.5</maven.assembly.plugin.version>
    <maven.compiler.plugin.version>3.3</maven.compiler.plugin.version>
    <maven.surefire.version>2.18.1</maven.surefire.version>
    <maven.resources.plugin.version>2.7</maven.resources.plugin.version>
    <exec.maven.plugin.version>1.2</exec.maven.plugin.version>
    <slf4j.version>1.7.5</slf4j.version>
    <jackson2.version>2.5.3</jackson2.version>
    <opencsv.version>2.4</opencsv.version>
    <metrics3.version>3.0.1</metrics3.version>
    <commons.logging.version>1.1.1</commons.logging.version>
    <sqlite4java.version>1.0.392</sqlite4java.version>
    <hamcrest.version>1.3</hamcrest.version>
    <hadoop.version>2.2.0</hadoop.version>
   <!-- <test.excluded.groups> com.thinkaurelius.titan.testcategory.MemoryTests,com.thinkaurelius.titan.testcategory.PerformanceTests,com.thinkaurelius.titan.testcategory.BrittleTests,com.thinkaurelius.titan.testcategory.OrderedKeyStoreTests,com.thinkaurelius.titan.testcategory.SerialTests </test.excluded.groups> -->
</properties>
<developers>
    <developer>
        <name>Alexander Patrikalakis</name>
        <email>[email protected]</email>
        <url>https://www.linkedin.com/in/amcpatrix/en</url>
    </developer>
    <developer>
        <name>Matthew Sowders</name>
        <email>[email protected]</email>
        <url>https://www.linkedin.com/in/matthewsowders/en</url>
    </developer>
    <developer>
        <name>Michael Rodaitis</name>
        <email>[email protected]</email>
    </developer>
</developers>
<contributors>
    <contributor>
        <name>Zameer Merali</name>
        <email>[email protected]</email>
    </contributor>
    <contributor>
        <name>Justin Panian</name>
        <email>[email protected]</email>
    </contributor>
</contributors>
<inceptionYear>2014</inceptionYear>
<licenses>
    <license>
        <name>The Apache Software License, Version 2.0</name>
        <url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
    </license>
</licenses>

<!-- Libraries -->
<dependencies>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>aws-java-sdk-dynamodb</artifactId>
        <version>${aws.java.sdk.version}</version>
    </dependency>
    <dependency>
        <groupId>com.amazonaws</groupId>
        <artifactId>DynamoDBLocal</artifactId>
        <version>${aws.java.sdk.version}</version>
    </dependency>
    <dependency>
        <groupId>com.thinkaurelius.titan</groupId>
        <artifactId>titan-core</artifactId>
        <version>${titan.version}</version>
    </dependency>
    <dependency>
        <groupId>com.thinkaurelius.titan</groupId>
        <artifactId>titan-test</artifactId>
        <version>${titan.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.thinkaurelius.titan</groupId>
        <artifactId>titan-es</artifactId>
        <version>${titan.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>com.codahale.metrics</groupId>
        <artifactId>metrics-core</artifactId>
        <version>${metrics3.version}</version>
    </dependency>
    <dependency>
        <groupId>au.com.bytecode</groupId>
        <artifactId>opencsv</artifactId>
        <version>${opencsv.version}</version>
    </dependency>
    <dependency>
        <groupId>com.fasterxml.jackson.datatype</groupId>
        <artifactId>jackson-datatype-json-org</artifactId>
        <version>${jackson2.version}</version>
    </dependency>
    <dependency>
        <groupId>org.slf4j</groupId>
        <artifactId>slf4j-log4j12</artifactId>
        <version>${slf4j.version}</version>
    </dependency>
    <!-- Gremlin -->
    <dependency>
        <groupId>org.apache.tinkerpop</groupId>
        <artifactId>gremlin-core</artifactId>
        <version>${tinkerpop.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.tinkerpop</groupId>
        <artifactId>gremlin-groovy</artifactId>
        <version>${tinkerpop.version}</version>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.apache.tinkerpop</groupId>
        <artifactId>gremlin-test</artifactId>
        <version>${tinkerpop.version}</version>
        <scope>test</scope>
    </dependency>
    <!-- for Gremlin console -->
    <dependency>
        <groupId>org.apache.tinkerpop</groupId>
        <artifactId>gremlin-console</artifactId>
        <version>${tinkerpop.version}</version>
        <scope>test</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>${maven.compiler.plugin.version}</version>
            <configuration>
                <source>${jdk.version}</source>
                <target>${jdk.version}</target>
            </configuration>
        </plugin>
        <plugin>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${maven.surefire.version}</version>
            <!-- Use the single-integration-tests and multi-integration-tests profiles below -->
            <configuration>
                <skip>true</skip>
            </configuration>
        </plugin>

        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-resources-plugin</artifactId>
            <version>${maven.resources.plugin.version}</version>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-dependency-plugin</artifactId>
            <version>${dependency.plugin.version}</version>
            <executions>
                <execution>
                    <id>copy-dependencies</id>
                    <phase>process-test-resources</phase>
                    <goals>
                        <goal>copy-dependencies</goal>
                    </goals>
                    <configuration>
                        <outputDirectory>${project.build.directory}/dependencies</outputDirectory>
                        <overWriteReleases>false</overWriteReleases>
                        <overWriteSnapshots>false</overWriteSnapshots>
                        <overWriteIfNewer>true</overWriteIfNewer>
                    </configuration>
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
<profiles>
    <profile>
        <id>start-dynamodb-local</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${exec.maven.plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>initialize</phase>
                            <configuration>
                                <executable>java</executable>
                                <arguments>
                                    <argument>-cp</argument>
                                    <classpath/>
                                    <argument>-Dsqlite4java.library.path=${basedir}/target/dependencies</argument>
                                    <argument>com.amazonaws.services.dynamodbv2.local.main.ServerRunner</argument>
                                    <!-- <argument> -inMemory </argument> -->
                <argument>-dbPath</argument>                
                <argument>${basedir}/src/test/resources/com/amazon/titan/diskstorage/dynamodb/DynamoDBStoreManager</argument>
                                    <argument>-port</argument>
                                    <argument>${dynamodb-local.port}</argument>
                                    <argument> -sharedDb </argument>
                                </arguments>
                            </configuration>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>single-integration-tests</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.version}</version>
                    <executions>
                        <execution>
                            <id>surefire-it</id>
                            <phase>test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <!-- <excludedGroups>${test.excluded.groups},com.amazon.titan.testcategory.MultipleItemTests</excludedGroups> -->
                                <groups>com.amazon.titan.testcategory.SingleItemTests</groups>
                                <skip>false</skip>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>multi-integration-tests</id>
        <build>
            <plugins>
                <plugin>
                    <artifactId>maven-surefire-plugin</artifactId>
                    <version>${maven.surefire.version}</version>
                    <executions>
                        <execution>
                            <id>surefire-it</id>
                            <phase>test</phase>
                            <goals>
                                <goal>test</goal>
                            </goals>
                            <configuration>
                                <!-- <excludedGroups>${test.excluded.groups},com.amazon.titan.testcategory.SingleItemTests</excludedGroups> -->
                                <groups>com.amazon.titan.testcategory.MultipleItemTests</groups>
                                <skip>false</skip>
                            </configuration>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
    <profile>
        <id>start-gremlin</id>
        <build>
            <plugins>
                <plugin>
                    <groupId>org.codehaus.mojo</groupId>
                    <artifactId>exec-maven-plugin</artifactId>
                    <version>${exec.maven.plugin.version}</version>
                    <executions>
                        <execution>
                            <phase>test</phase>
                            <configuration>
                                <executable>java</executable>
                                <arguments>
                                    <argument>-Dsqlite4java.library.path=${basedir}/target/dependencies</argument>
                                    <argument>-cp</argument>
                                    <argument>${basedir}/target/dependencies/*${path.separator}${basedir}/target/dynamodb-titan100-storage-backend-1.0.0.jar</argument>
                                    <argument>org.apache.tinkerpop.gremlin.console.Console</argument>
                                </arguments>
                            </configuration>
                            <goals>
                                <goal>exec</goal>
                            </goals>
                        </execution>
                    </executions>
                </plugin>
            </plugins>
        </build>
    </profile>
</profiles>
<repositories>
    <repository>
        <id>dynamodblocal</id>
        <name>AWS DynamoDB Local Release Repository</name>
        <url>http://dynamodb-local.s3-website-us-west-2.amazonaws.com/release</url>
        <snapshots>
            <enabled>false</enabled>
        </snapshots>
    </repository>
</repositories>
<dependencyManagement>
    <dependencies>
        <dependency>
            <groupId>org.hamcrest</groupId>
            <artifactId>hamcrest-core</artifactId>
            <version>${hamcrest.version}</version>
        </dependency>
        <dependency>
            <groupId>com.almworks.sqlite4java</groupId>
            <artifactId>sqlite4java</artifactId>
            <version>${sqlite4java.version}</version>
        </dependency>
        <dependency>
            <groupId>commons-logging</groupId>
            <artifactId>commons-logging</artifactId>
            <version>${commons.logging.version}</version>
        </dependency>

    </dependencies>
</dependencyManagement>

4
I'm having the same issue. Just raised this: github.com/awslabs/dynamodb-titan-storage-backend/issues/56John Stephenson
After poking some people, the issue for me is resolved.John Stephenson

4 Answers

0
votes

According to this blog post, it looks like DynamoDB Local is now available in AWS Maven Repo. So you should simply substitute the <repository> node in your pom.xml with something like:

<repository>
    <id>dynamodb-local</id>
    <name>DynamoDB Local Release Repository</name>
    <url>https://s3-us-west-2.amazonaws.com/dynamodb-local/release</url>
</repository>

Hope it helps.

0
votes

In August 2018 Amazon announced new Docker image with Amazon DynamoDB Local onboard. It does not require downloading and running any JARs as well as adding using third-party OS-specific binaries like sqlite4java.

It is as simple as starting a Docker container before the tests:

docker run -p 8000:8000 amazon/dynamodb-local

You can do that manually for local development, as described above, or use it in your CI pipeline. Many CI services provide an ability to start additional containers during the pipeline that can provide dependencies for your tests. Here is an example for Gitlab CI/CD:

test:
  stage: test
  image: openjdk:8-alpine
  services:
    - name: amazon/dynamodb-local
      alias: dynamodb-local
  script:
    - DYNAMODB_LOCAL_URL=http://dynamodb-local:8000 ./gradlew clean test

So, during the test task DynamoDB will be available on http://dynamodb-local:8000.

Another, more powerful tool is localstack. It supports two dozen of AWS services, DynamoDB is one of them. The isage is very similar, you have to start it before running the tests and it will expose AWS-compatible APIs on given ports:

test:
  stage: test
  image: openjdk:8-alpine
  services:
    - name: localstack/localstack
    alias: localstack
  script:
    - ./gradlew clean test
-2
votes

Aaahhh! yes, i have resolve it making changes in pom file like this

<dependency> <groupId>com.amazonaws</groupId> <artifactId>DynamoDBLocal</artifactId> <version>1.11.0.1</version> </dependency>

instead of

<dependency> <groupId>com.amazonaws</groupId> <artifactId>DynamoDBLocal</artifactId> <version>${aws.java.sdk.version}</version> </dependency>