引起:java.lang.ClassNotFoundException:com.amazonaws.transform.JsonErrorUnmarshallerV2

时间:2017-04-10 18:44:53

标签: amazon-web-services classnotfoundexception

我很确定原因是因为版本不匹配所以即时共享我所有的pom文件,我有一个项目模块当我在其中一个模块中工作时我必须使用cognito我添加了依赖并改变了所有其他更新版本,因为cognito不支持旧版本,但现在在另一个模块中我得到此错误

     <dependencies>
              <dependency>
                <groupId>com.amazonaws</groupId>
                <artifactId>aws-java-sdk-bom</artifactId>
                <version>1.11.109</version>
                <type>pom</type>
                <scope>import</scope>
              </dependency>
    </dependencies>

     </dependencyManagement>

            <dependencies>


                <dependency>
                    <groupId>javax.servlet</groupId>
                    <artifactId>javax.servlet-api</artifactId>
                    <version>3.1.0</version>
                </dependency>

                <dependency>
                    <groupId>org.postgresql</groupId>
                    <artifactId>postgresql</artifactId>
                    <version>9.4-1201-jdbc41</version>
                </dependency>

                <dependency>
                    <groupId>net.postgis</groupId>
                    <artifactId>postgis-jdbc</artifactId>
                    <version>2.2.0</version>
                    <exclusions>
                        <exclusion>
                            <groupId>postgresql</groupId>
                            <artifactId>postgresql</artifactId>
                        </exclusion>
                    </exclusions>
                </dependency>

                <!-- Jackson -->
                <dependency>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-core</artifactId>
                    <version>2.6.6</version>
                </dependency>
                <dependency>
                    <groupId>com.fasterxml.jackson.core</groupId>
                    <artifactId>jackson-databind</artifactId>
                    <version>2.6.6</version>
                </dependency>


                <!-- Spring -->
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-web</artifactId>
                    <version>${org.springframework.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context</artifactId>
                    <version>${org.springframework.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-aspects</artifactId>
                    <version>${org.springframework.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-webmvc</artifactId>
                    <version>${org.springframework.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-tx</artifactId>
                    <version>${org.springframework.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-context-support</artifactId>
                    <version>${org.springframework.version}</version>
                </dependency>

                <!-- Spring JDBC -->
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-jdbc</artifactId>
                    <version>${org.springframework.version}</version>
                </dependency>

                <!-- Spring Security -->
                <dependency>
                    <groupId>org.springframework.security</groupId>
                    <artifactId>spring-security-core</artifactId>
                    <version>${spring.security.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework.security</groupId>
                    <artifactId>spring-security-web</artifactId>
                    <version>${spring.security.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework.security</groupId>
                    <artifactId>spring-security-config</artifactId>
                    <version>${spring.security.version}</version>
                </dependency>

                <dependency>
                    <groupId>org.springframework.security</groupId>
                    <artifactId>spring-security-taglibs</artifactId>
                    <version>${spring.security.version}</version>
                </dependency>

                <dependency>
                    <groupId>org.springframework.security.oauth</groupId>
                    <artifactId>spring-security-oauth2</artifactId>
                    <version>2.0.2.RELEASE</version>
                </dependency>
        <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-jms</artifactId>
                    <version>${org.springframework.version}</version>
                </dependency>





                <!-- JSTL -->
                <dependency>
                    <groupId>jstl</groupId>
                    <artifactId>jstl</artifactId>
                    <version>1.2</version>
                </dependency>
                <dependency>
                    <groupId>taglibs</groupId>
                    <artifactId>standard</artifactId>
                    <version>1.1.2</version>
                </dependency>

                <!-- Logging -->
                <dependency>
                    <groupId>org.slf4j</groupId>
                    <artifactId>slf4j-log4j12</artifactId>
                    <version>1.6.1</version>
                </dependency>



                <!-- AspectJ dependencies -->
                <dependency>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-aop</artifactId>
                    <version>${org.springframework.version}</version>
                </dependency>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjrt</artifactId>
                    <version>${aspectj.version}</version>
                    <scope>runtime</scope>
                </dependency>
                <dependency>
                    <groupId>org.aspectj</groupId>
                    <artifactId>aspectjtools</artifactId>
                    <version>${aspectj.version}</version>
                </dependency>

                <!-- Gson: Java to Json conversion -->
                <dependency>
                    <groupId>com.google.code.gson</groupId>
                    <artifactId>gson</artifactId>
                    <version>2.2.4</version>
                </dependency>
                <dependency>
                    <groupId>javax.mail</groupId>
                    <artifactId>mail</artifactId>
                    <version>1.4</version>
                </dependency>
                <dependency>
                    <groupId>javax.activation</groupId>
                    <artifactId>activation</artifactId>
                    <version>1.1</version>
                </dependency>

                <!-- Swagger web service documentation-->



                <!-- Apache Commons FileUpload -->
                <dependency>
                    <groupId>commons-fileupload</groupId>
                    <artifactId>commons-fileupload</artifactId>
                    <version>1.3.1</version>
                </dependency>

                <!-- Apache Commons IO -->
                <dependency>
                    <groupId>commons-io</groupId>
                    <artifactId>commons-io</artifactId>
                    <version>2.4</version>
                </dependency>

                <dependency>
                    <groupId>commons-codec</groupId>
                    <artifactId>commons-codec</artifactId>
                    <version>1.10</version>
                </dependency>

            <dependency>
                <groupId>org.apache.commons</groupId>
                <artifactId>commons-dbcp2</artifactId>
                <version>2.1</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-starter-aws-messaging</artifactId>
                <version>1.1.0.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-aws</artifactId>
                <version>1.1.0.RELEASE</version>
                <type>pom</type>
            </dependency>
            <dependency>
                <groupId>org.springframework.cloud</groupId>
                <artifactId>spring-cloud-aws-core</artifactId>
                <version>1.1.0.RELEASE</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger2</artifactId>
                 <version>2.5.1-SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-core</artifactId>
                 <version>2.5.1-SNAPSHOT</version>
            </dependency>
            <dependency>
                <groupId>io.springfox</groupId>
                <artifactId>springfox-swagger-ui</artifactId>
                 <version>2.5.1-SNAPSHOT</version>
            </dependency>
</dependencies>

在另一个档案中:

<dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-bom</artifactId>
            <version>1.11.109</version>
            <type>pom</type>
            <scope>import</scope>
        </dependency> 

          <dependency>
            <groupId>com.amazonaws</groupId>
            <artifactId>aws-java-sdk-dynamodb</artifactId>
            <version>1.11.109</version>
    </dependency> 



 <dependency>
    <groupId>com.amazonaws</groupId>
    <artifactId>aws-java-sdk-cognitoidp</artifactId>
    <version>1.11.109</version>
</dependency>  

2 个答案:

答案 0 :(得分:0)

添加aws-java-sdk依赖项将起作用。

https://mvnrepository.com/artifact/com.amazonaws/aws-java-sdk

答案 1 :(得分:0)

您应该添加aws核心依赖关系,而不是上面答案中建议的完整sdk

getResource()