【发布时间】:2015-10-16 21:28:27
【问题描述】:
我想设置一个 Java Spring 和 MongoDB 的简单示例,但我还没有做到。在这种情况下,我遵循 Spring web 中的示例。
我已经使用 JRE8 安装了 Maven、Mongo DB 和 Java JDK 1.8。此外,在 pom.xml 文件中,由于编译错误,我不得不包含此依赖项:
<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-rest-core</artifactId>
<version>2.3.1.RELEASE</version>
</dependency>
最后,按照上面提到的网页说明,我输入:
mvn spring-boot:run 要么 java -jar 目标/gs-accessing-data-mongodb-0.1.0.jar
在第一种情况下,spring-boot,我得到以下错误:
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.2.5.RELEASE:run (default-cli) on project gs-accessing-data-mongodb: An exception occured while running. null: InvocationTargetException: Error creating bean with name 'messageConverters' defined in class path resource [org/springframework/boot/autoconfigure/web/HttpMessageConvertersAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.boot.autoconfigure.web.HttpMessageConverters]: Factory method 'messageConverters' threw exception; nested exception is java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException: com.fasterxml.jackson.core.JsonProcessingException -> [Help 1]
有什么想法吗?提前致谢。
【问题讨论】: