我已经添加了代码来实现我的Spring MVC项目的RestTemplate客户端(Eclipse,Maven,Spring 3.1.0.RELEASE)。一切都在构建,当我启动到Tomcat7时,我得到了下面的输出。它可能是我在pom.xml中缺少的Spring工件吗?我有
org.springframework.beans.factory.BeanCreationException: Error creating bean
.
.
nested exception is java.lang.NoClassDefFoundError: org/apache/http/auth/Credentials
Caused by: java.lang.ClassNotFoundException: org.apache.http.auth.Credentials
at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1521)
... 39 more
Caused by: java.lang.ClassNotFoundException: org.apache.http.auth.Credentials
at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1676)
at org.apache.catalina.loader.WebappClassLoader.loadC lass(WebappClassLoader.java:1521)
... 39 more
答案 0 :(得分:4)
你需要apache http组件:
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.1.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.1.1</version>
</dependency>