-
Feb 12th, 2012, 01:02 PM
#1
RestTemplate and org.apache.http.auth.Credentials runtime issue
I've added code to implement a RestTemplate Client to my Spring MVC project (Eclipse, Maven, Spring 3.1.0.RELEASE). Everything builds and when I launch to Tomcat7, I get the output below. Is it possibly a Spring artifact I'm missing in the pom.xml? I've got spring-webmvc (excluding commons-logging), spring-oxm, spring-secutiy-web, spring-security-config, spring-tx, spring-aop, spring-orm, spring-test.
org.springframework.beans.factory.BeanCreationExce ption: 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
When I create RestTemplate I simply set up the http client with Basic Auth credentials.
final DefaultHttpClient httpclient = new DefaultHttpClient();
httpclient.getCredentialsProvider().setCredentials (
new AuthScope(targetHost.getHostName(), targetHost.getPort(),
AuthScope.ANY_REALM),
new UsernamePasswordCredentials(this.username, this.password));
-
Feb 12th, 2012, 02:45 PM
#2
Problem solved, I had the scope set to test in my pom.xml for the httpclient and httpcore dependcies.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules