wheelmap-android
wheelmap-android copied to clipboard
org.springframework.web.client.HttpClientErrorException: 404 Not Found
org.springframework.web.client.HttpClientErrorException: 404 Not Found
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:76)
at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:524)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:481)
at org.wheelmap.android.net.request.RestTemplateExt.doExecute(RestTemplateExt.java:43)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:453)
at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:251)
at org.wheelmap.android.net.request.RequestProcessor.get(RequestProcessor.java:84)
at org.wheelmap.android.net.AbstractExecutor.executeRequest(AbstractExecutor.java:232)
at org.wheelmap.android.net.SinglePageExecutor.executeSingleRequest(SinglePageExecutor.java:68)
at org.wheelmap.android.net.NodeExecutor.execute(NodeExecutor.java:59)
at org.wheelmap.android.service.RestService.onHandleIntent(RestService.java:105)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.os.HandlerThread.run(HandlerThread.java)
org.springframework.web.client.HttpClientErrorException: 404 Not Found
at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:76)
at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:524)
at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:481)
at org.wheelmap.android.net.request.RestTemplateExt.doExecute(RestTemplateExt.java:43)
at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:453)
at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:251)
at org.wheelmap.android.net.request.RequestProcessor.get(RequestProcessor.java:84)
at org.wheelmap.android.net.AbstractExecutor.executeRequest(AbstractExecutor.java:232)
at org.wheelmap.android.net.SinglePageExecutor.executeSingleRequest(SinglePageExecutor.java:68)
at org.wheelmap.android.net.NodeExecutor.execute(NodeExecutor.java:59)
at org.wheelmap.android.service.RestService.onHandleIntent(RestService.java:105)
at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java)
at android.os.Handler.dispatchMessage(Handler.java)
at android.os.Looper.loop(Looper.java)
at android.os.HandlerThread.run(HandlerThread.java)
Hello,
Did you resolve this?
RestTemplate template = new RestTemplate();
template.postForObject(emailServiceURI,params,ParametersFromFilenet.class);
WARNING: POST request for "http://ustlsawphxt039.example.com/wsEmailCustomerNotification/api" resulted in 404 (Not Found); invoking error handler 404 Not Found org.springframework.web.client.HttpClientErrorException: 404 Not Found at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:88) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:537) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:493) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:452) at org.springframework.web.client.RestTemplate.postForObject(RestTemplate.java:302)
....
in context with path [/TwitterStreaming-1.0.0-BUILD-SNAPSHOT] threw exception [Request processing failed; nested exception is org.sprin gframework.web.client.HttpClientErrorException: 404 Not Found] with root cause org.springframework.web.client.HttpClientErrorException: 404 Not Found at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:76) at org.springframework.web.client.RestTemplate.handleResponseError(RestTemplate.java:486) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:443) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401) at org.springframework.web.client.RestTemplate.put(RestTemplate.java:327) at com.bt.product.rest.ui.client.UIRestClient.RestClient(UIRestClient.java:25) at com.bt.product.Restcontroller.HomeController.create(HomeController.java:80) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213) at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
spring rest controller:
@RequestMapping(value = "/", method = RequestMethod.POST,headers = "Accept=application/json") @ResponseBody public String create(@RequestBody String Keys) { JSONParser jsonParser = new JSONParser(); try { JSONObject jsonObject = (JSONObject) jsonParser.parse(Keys); //twitter keys details String ConsumerKey=(String) jsonObject.get("ConsumerKey"); String ConsumerSecret=(String) jsonObject.get("ConsumerSecret") ; String AccessToken=(String) jsonObject.get("AccessToken"); String AccessTokenSecret=(String) jsonObject.get("AccessTokenSecret"); String Latitude=(String) jsonObject.get("Latitude"); String Longitude=(String) jsonObject.get("Longitude"); Boolean isHashTag= (Boolean) jsonObject.get("isHashTag"); String keywords=(String) jsonObject.get("keywords"); String hashtag=(String) jsonObject.get("Hash_tagName"); System.out.println("hashtag:"+hashtag); /* rest response pid,lid,sid,uid,"200",*/
String pid=(String) jsonObject.get("pid");
String lid=(String) jsonObject.get("lid");
String sid=(String) jsonObject.get("sid");
String uid=(String) jsonObject.get("uid");
UIRestClient.RestClient(pid,lid,sid,uid,200);
System.out.println("uid"+uid+"pid"+pid+"lid"+lid+"sid"+sid);
client code:
public class UIRestClient { public static final String SERVER_URI = "http://192.168.1.77:3000/social_process_logs/"; public static void RestClient(String pid,String lid,String sid,String uid, int processStatusId) {
String psid=processStatusId+"";
//System.out.println("pid"+pid,"lid"+lid);
RestTemplate restTemplate = new RestTemplate();
Map<String, String> req = new HashMap<String,String>();
req.put("project_id", pid);
req.put("user_id",lid);
req.put("source_social_id", sid);
req.put("user_id", uid);
req.put("process_status_id", psid);
restTemplate.put(SERVER_URI+lid+".json", req);
}
Rest Service:- @RequestMapping(value = "/ws/WSDicomFileProgress/", method = RequestMethod.POST ,consumes = "application/json") @ResponseBody public void WSDicomFileProgress(@RequestBody Map processCompleted) throws Exception { System.out.println("WSMoveProcess Enter"); try {
System.out.println(processCompleted);
webSocket.convertAndSend("/updates/dcmprocess", processCompleted);
} catch (Exception e) {
e.printStackTrace();
}
System.out.println("WSMoveProcess Exit");
}
RestTemplate:-
Map<String, Object> wsResponse = new LinkedHashMap<String, Object>();
wsResponse.put("meta_id", 1);
wsResponse.put("value", 100);
wsResponse.put("process","Hi");
RestTemplate restTemplate = new RestTemplate();
List<HttpMessageConverter>> list = new ArrayList
//String url = "http://localhost:8080/add";
HttpEntity<Map<String, Object>> entity = new HttpEntity<Map<String, Object>>(wsResponse);
ResponseEntity<Map> response = restTemplate.postForEntity("http://localhost:8080/ws/WSDicomFileProgress/", entity, Map.class);
context with path [] threw exception [Request processing failed; nested exception is org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found] with root cause org.springframework.web.client.HttpClientErrorException$NotFound: 404 Not Found How should this problem be solved?