wheelmap-android icon indicating copy to clipboard operation
wheelmap-android copied to clipboard

org.springframework.web.client.HttpClientErrorException: 404 Not Found

Open christoph-buente opened this issue 10 years ago • 5 comments

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)

christoph-buente avatar Jul 05 '14 08:07 christoph-buente

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)

....

rhali786 avatar Sep 12 '14 14:09 rhali786

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)

samynathan17 avatar Apr 12 '16 13:04 samynathan17

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);

}

samynathan17 avatar Apr 12 '16 13:04 samynathan17

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>(); list.add(new MappingJackson2HttpMessageConverter()); restTemplate.setMessageConverters(list);

        //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);

karuppasamyit10 avatar Sep 15 '16 12:09 karuppasamyit10

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?

jkgk7712 avatar Jun 28 '19 03:06 jkgk7712