2017-01-04 22 views
1

私はpom.xmlファイルを持っているので、いくつかの依存関係を追加しました。 java.lang.ClassNotFoundException: COMマイポンポンファイルは次のようになります...エラー:原因:java.lang.ClassNotFoundException:com.amazonaws.protocol.json.SdkJsonMarshallerFactory

<!-- Libraries --> 
<dependencies> 
    <dependency> 
     <groupId>com.amazonaws</groupId> 
     <artifactId>aws-java-sdk</artifactId> 
     <version>1.10.39</version> 
    </dependency> 
    <dependency> 
     <groupId>com.amazonaws</groupId> 
     <artifactId>aws-java-sdk-core</artifactId> 
     <version>1.10.3</version> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.dataformat/jackson-dataformat-cbor --> 
    <dependency> 
     <groupId>com.fasterxml.jackson.dataformat</groupId> 
     <artifactId>jackson-dataformat-cbor</artifactId> 
     <version>2.7.0</version> 
    </dependency> 
    <dependency> 
     <groupId>com.amazonaws</groupId> 
     <artifactId>aws-java-sdk-dynamodb</artifactId> 
     <version>${aws.java.sdk.version}</version> 
    </dependency> 

     <!-- https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk-s3 --> 
    <dependency> 
     <groupId>com.amazonaws</groupId> 
     <artifactId>aws-java-sdk-s3</artifactId> 
     <version>1.10.3</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> 
<!-- https://mvnrepository.com/artifact/joda-time/joda-time --> 
<dependency> 
    <groupId>joda-time</groupId> 
     <artifactId>joda-time</artifactId> 
     <version>2.8.1</version> 
</dependency> 
    <dependency> 
     <groupId>com.thinkaurelius.titan</groupId> 
     <artifactId>titan-test</artifactId> 
     <version>${titan.version}</version> 
     <scope>test</scope> 
    </dependency> 
    <!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> 
    <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> 
<!-- https://mvnrepository.com/artifact/org.apache.httpcomponents/httpclient --> 
<dependency> 
     <groupId>org.apache.httpcomponents</groupId> 
     <artifactId>httpclient</artifactId> 
     <version>${httpcomponents.httpclient.version}</version> 
</dependency> 
    <dependency> 
     <groupId>com.fasterxml.jackson.datatype</groupId> 
     <artifactId>jackson-datatype-json-org</artifactId> 
     <version>${jackson2.version}</version> 
    </dependency> 
<!-- https://mvnrepository.com/artifact/commons-logging/commons-logging --> 
<dependency> 
    <groupId>commons-logging</groupId> 
     <artifactId>commons-logging</artifactId> 
    </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>-port</argument> 
       <argument>${dynamodb-local.port}</argument> 
       <argument>-dbPath</argument> 

      <argument>${basedir}/com/amazon/titan/diskstorage/dynamodb/DynamoDBStoreManager</argument>     
     <!-- <argument>${basedir}/src/test/resources/com/amazon/titan/diskstorage/dynamodb/DynamoDBStoreManager</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://localhost:4567</url> 
     <snapshots> 
      <enabled>true</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> 

は、今では私にこのようなエラーに何か...によって引き起こさ

を引き起こしました。 amazonaws.protocol.json.SdkJsonMarshallerFactory

答えて

0

ビルド変数を定義している場所がわからないので、あなたはおそらくAWSライブラリ間のバージョンが一致しません。そのクラスは新しいものと思われ、あなたが引っ張っているlibのバージョンには存在しないかもしれません。 (私は1.11.72で参照していますが、その前に存在していた可能性があります)。

"mvn dependency:tree"を実行して、さまざまなAWSライブラリのすべてのバージョンをプルダウンして並べ替える方法を見てみましょう。

*注:私はこの同じ問題を抱えているが、私の場合、私はMVNシェードプラグインを使用していますし、それは、これらのクラスをフィルタリングだどこか上流..

2

実際の問題は、異なるバージョンのミキシングされますAWS Jars。

たとえば、以下の依存関係には1.10.39または1.10.3を使用する必要があります。

同様に、他のすべてについてcom.amazonaws groupIds。

<dependency> 
     <groupId>com.amazonaws</groupId> 
     <artifactId>aws-java-sdk</artifactId> 
     <version>1.10.39</version> 
    </dependency> 
    <dependency> 
     <groupId>com.amazonaws</groupId> 
     <artifactId>aws-java-sdk-core</artifactId> 
     <version>1.10.3</version> 
    </dependency> 

私は同じ問題を抱えています。すべてのcom.amazonaws groupIdで同じバージョンを一貫して維持すると、問題は解決しました。

関連する問題