when i access the rezgo sample api using restful webservice i get an exception. I want to get this answer in the sample object package com.mycompany.hr.client;
import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; import java.util.List; import java.util.Map; import org.apache.log4j.Logger; import org.springframework.http.HttpEntity; import org.springframework.http.HttpHeaders; import org.springframework.http.HttpMethod; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.stereotype.Controller; import org.springframework.ui.Model; import org.springframework.web.bind.annotation.ModelAttribute; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMethod; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.client.RestOperations; import org.springframework.web.client.RestTemplate; import org.springframework.ws.client.core.WebServiceTemplate; public class Main { public static void main(String[] args) throws Exception { List<MediaType> acceptableMediaTypes = new ArrayList<MediaType>(); acceptableMediaTypes.add(MediaType.APPLICATION_XML); HttpHeaders headers = new HttpHeaders(); headers.setAccept(acceptableMediaTypes);
this is my code, i get the following exception.
Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.util.CollectionUtils.unmodifiableMultiValueMap(Lorg/springframework/util/MultiValueMap;)Lorg/springframework/util/MultiValueMap; at org.springframework.web.util.UriComponents.<init>(UriComponents.java:100) at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:222) at org.springframework.web.util.UriComponentsBuilder.build(UriComponentsBuilder.java:212) at org.springframework.web.util.UriTemplate.<init>(UriTemplate.java:70) at org.springframework.web.client.RestTemplate$HttpUrlTemplate.<init>(RestTemplate.java:653) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:407) at org.springframework.web.client.RestTemplate.getForEntity(RestTemplate.java:229) at com.mycompany.hr.client.Main.main(Main.java:52)
please help me solve this problem.
source share