Spring RestTemplate添加,Tomcat7发布时出现异常

时间:2012-02-12 19:20:59

标签: java spring maven resttemplate

我已经添加了代码来实现我的Spring MVC项目的RestTemplate客户端(Eclipse,Maven,Spring 3.1.0.RELEASE)。一切都在构建,当我启动到Tomcat7时,我得到了下面的输出。它可能是我在pom.xml中缺少的Spring工件吗?我有

  • spring-webmvc(不包括公共日志记录)
  • 弹簧OXM
  • 弹簧安全的Web
  • 弹簧安全配置
  • 弹簧-TX
  • 弹簧的AOP
  • 弹簧ORM
  • 弹簧测试
  • apache httpclient(不包括commons-logging)。

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

1 个答案:

答案 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>