org.springframework.web.client.RestClientException

If you like a tip written by other Samebug users, mark is as helpful! Marks help our algorithm provide you better solutions and also help other users.
tip

Check if your path is correct, if it's correct already you have to register your path to the mapping configuration.


rafael

You have a different solution? A short tip here would help you and many other users who saw this issue last week.

  • Livy Interpreter gets a NestedRuntimException when running with Kerberized components. INFO [2016-10-13 22:24:37,576] ({pool-2-thread-4} SchedulerFactory.java[jobStarted]:131) - Job remoteInterpretJob_1476411877576 started by scheduler org.apache.zeppelin.livy.LivySparkInterpreter103042912 ERROR [2016-10-13 22:24:37,935] ({pool-2-thread-4} LivyHelper.java[interpretInput]:190) - Interpreter exception org.springframework.web.client.RestClientException: Error running rest call; nested exception is org.springframework.web.client.HttpClientErrorException: 404 Not Found at org.springframework.security.kerberos.client.KerberosRestTemplate.doExecute(KerberosRestTemplate.java:196) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:580) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:498) at org.apache.zeppelin.livy.LivyHelper.executeHTTP(LivyHelper.java:356) at org.apache.zeppelin.livy.LivyHelper.executeCommand(LivyHelper.java:297) at org.apache.zeppelin.livy.LivyHelper.interpret(LivyHelper.java:238) at org.apache.zeppelin.livy.LivyHelper.interpretInput(LivyHelper.java:188) at org.apache.zeppelin.livy.LivySparkInterpreter.interpret(LivySparkInterpreter.java:108) at org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:94) at org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:390) at org.apache.zeppelin.scheduler.Job.run(Job.java:176) at org.apache.zeppelin.scheduler.FIFOScheduler$1.run(FIFOScheduler.java:139) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.web.client.HttpClientErrorException: 404 Not Found at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91) at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:667) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:620) at org.springframework.security.kerberos.client.KerberosRestTemplate.doExecuteSubject(KerberosRestTemplate.java:202) at org.springframework.security.kerberos.client.KerberosRestTemplate.access$100(KerberosRestTemplate.java:67) at org.springframework.security.kerberos.client.KerberosRestTemplate$1.run(KerberosRestTemplate.java:191) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:360) at org.springframework.security.kerberos.client.KerberosRestTemplate.doExecute(KerberosRestTemplate.java:187) ... 18 more INFO [2016-10-13 22:24:37,937] ({pool-2-thread-4} SchedulerFactory.java[jobFinished]:137) - Job remoteInterpretJob_1476411877576 finished by scheduler org.apache.zeppelin.livy.LivySparkInterpreter103042912
    via by Greg Senia,
  • I have setup my machine behind a firewall that requires me to use an authenticating proxy to make external connection. The proxy uses 'digest' based authentication (this may or may not matter). I have the proxy setup correctly in Eclipse preferences, including user credentials. When I right click CF in servers view and attempt to 'Connect' I get this error: {code} eclipse.buildId=4.3.0.M20130911-1000 java.version=1.7.0_45 java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86_64, WS=gtk, NL=en_CA Framework arguments: -product org.springsource.sts.ide Command-line arguments: -os linux -ws gtk -arch x86_64 -product org.springsource.sts.ide Error Mon Dec 23 10:21:32 PST 2013 An internal error occurred during: "Connecting to server". org.springframework.web.client.HttpClientErrorException: 407 Proxy Authentication Required 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.cloudfoundry.client.lib.rest.LoggingRestTemplate.doExecute(LoggingRestTemplate.java:54) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:401) at org.springframework.web.client.RestTemplate.getForObject(RestTemplate.java:199) at org.cloudfoundry.client.lib.rest.CloudControllerClientFactory.getInfoMap(CloudControllerClientFactory.java:86) at org.cloudfoundry.client.lib.rest.CloudControllerClientFactory.newCloudController(CloudControllerClientFactory.java:65) at org.cloudfoundry.client.lib.CloudFoundryClient.<init>(CloudFoundryClient.java:97) at org.cloudfoundry.client.lib.CloudFoundryClient.<init>(CloudFoundryClient.java:89) at org.cloudfoundry.ide.eclipse.internal.server.core.client.CloudFoundryClientFactory.getCloudFoundryOperations(CloudFoundryClientFactory.java:72) at org.cloudfoundry.ide.eclipse.internal.server.core.client.CloudFoundryClientFactory.getCloudFoundryOperations(CloudFoundryClientFactory.java:55) at org.cloudfoundry.ide.eclipse.internal.server.core.client.CloudFoundryServerBehaviour.createClient(CloudFoundryServerBehaviour.java:1614) at org.cloudfoundry.ide.eclipse.internal.server.core.client.CloudFoundryServerBehaviour.createClient(CloudFoundryServerBehaviour.java:1596) at org.cloudfoundry.ide.eclipse.internal.server.core.client.CloudFoundryServerBehaviour.createClient(CloudFoundryServerBehaviour.java:1586) at org.cloudfoundry.ide.eclipse.internal.server.core.spaces.CloudSpaceServerLookup.getCloudOrgsAndSpaces(CloudSpaceServerLookup.java:118) at org.cloudfoundry.ide.eclipse.internal.server.core.spaces.CloudSpaceServerLookup.getCloudOrgsAndSpaces(CloudSpaceServerLookup.java:113) at org.cloudfoundry.ide.eclipse.internal.server.core.spaces.CloudSpaceServerLookup.getCloudSpace(CloudSpaceServerLookup.java:88) at org.cloudfoundry.ide.eclipse.internal.server.core.client.CloudFoundryServerBehaviour.getClient(CloudFoundryServerBehaviour.java:1116) at org.cloudfoundry.ide.eclipse.internal.server.core.client.CloudFoundryServerBehaviour.getClient(CloudFoundryServerBehaviour.java:1138) at org.cloudfoundry.ide.eclipse.internal.server.core.client.CloudFoundryServerBehaviour$Request.run(CloudFoundryServerBehaviour.java:1714) at org.cloudfoundry.ide.eclipse.internal.server.core.client.CloudFoundryServerBehaviour.connect(CloudFoundryServerBehaviour.java:168) at org.cloudfoundry.ide.eclipse.internal.server.ui.actions.ConnectAction$1.run(ConnectAction.java:61) at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53) {code}
    via by Kris De Volder (c),
  • I've been trying to send a multipart post via restTemplate and have been unable to get it to work with anything but FileSystemResource. In my use case (a weird file-forwarding use case) this forces me to copy a MultiPartFile InputStream into a temp file in order be able to create a FileSystemResource, which seems undesirable. Here's a testing version of the file-receiving controller (from another project, running in another servlet container): {code} @RestController public class FileReceiveController { private Log log = LogFactory.getLog(FileReceiveController.class); @RequestMapping(method = RequestMethod.POST) public void uploadFile(@RequestParam("customerId") int customerId, @RequestPart("file") MultipartFile multipartFile) { log.info("customerId: " + customerId); log.info("Received multipart file - original filename: " + multipartFile.getOriginalFilename()); log.info("content-type: " + multipartFile.getContentType()); log.info("size: " + multipartFile.getSize()); } } {code} Here's the file-forwarding controller: {code} @RestController public class FileForwardController { private RestTemplate restTemplate; public FileForwardController() { SimpleClientHttpRequestFactory requestFactory = new SimpleClientHttpRequestFactory(); requestFactory.setBufferRequestBody(false); this.restTemplate = new RestTemplate(requestFactory); } @RequestMapping(method = RequestMethod.POST) public void uploadFile(@RequestParam("customerId") int customerId, @RequestPart("file") MultipartFile multipartFile) { MultiValueMap<String,Object> parts = new LinkedMultiValueMap<>(); parts.add("customerId", customerId); try { // copy to temp file and use FileSystemResource // File tempFile = File.createTempFile("xyz", ""); // FileCopyUtils.copy(multipartFile.getInputStream(), new FileOutputStream(tempFile)); // parts.add("file", new FileSystemResource(tempFile)); // OR use InputStreamResource (broken) parts.add("file", new InputStreamResource(multipartFile.getInputStream())); // OR use ByteArrayResource (broken) // parts.add("file", new ByteArrayResource(multipartFile.getBytes())); } catch (IOException e) { throw new RuntimeException(e); } HttpHeaders headers = new HttpHeaders(); headers.setContentType(MediaType.MULTIPART_FORM_DATA); HttpEntity<MultiValueMap<String,Object>> request = new HttpEntity<>(parts, headers); restTemplate.exchange("http://localhost:8080", HttpMethod.POST, request, Void.class); } } {code} In this form, the restTemplate.exchange call throws {code} org.springframework.web.client.HttpClientErrorException: 400 Bad Request at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91) at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:614) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:570) {code} The ByteArrayResource form does the same thing. Only the FileSystemResource form works.
    via by Greg Adams,
    • org.springframework.web.client.RestClientException: Error running rest call; nested exception is org.springframework.web.client.HttpClientErrorException: 404 Not Found at org.springframework.security.kerberos.client.KerberosRestTemplate.doExecute(KerberosRestTemplate.java:196) at org.springframework.web.client.RestTemplate.execute(RestTemplate.java:580) at org.springframework.web.client.RestTemplate.exchange(RestTemplate.java:498) at org.apache.zeppelin.livy.LivyHelper.executeHTTP(LivyHelper.java:356) at org.apache.zeppelin.livy.LivyHelper.executeCommand(LivyHelper.java:297) at org.apache.zeppelin.livy.LivyHelper.interpret(LivyHelper.java:238) at org.apache.zeppelin.livy.LivyHelper.interpretInput(LivyHelper.java:188) at org.apache.zeppelin.livy.LivySparkInterpreter.interpret(LivySparkInterpreter.java:108) at org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:94) at org.apache.zeppelin.interpreter.remote.RemoteInterpreterServer$InterpretJob.jobRun(RemoteInterpreterServer.java:390) at org.apache.zeppelin.scheduler.Job.run(Job.java:176) at org.apache.zeppelin.scheduler.FIFOScheduler$1.run(FIFOScheduler.java:139) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180) at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293) at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) at java.lang.Thread.run(Thread.java:745) Caused by: org.springframework.web.client.HttpClientErrorException: 404 Not Found at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:91) at org.springframework.web.client.RestTemplate.handleResponse(RestTemplate.java:667) at org.springframework.web.client.RestTemplate.doExecute(RestTemplate.java:620) at org.springframework.security.kerberos.client.KerberosRestTemplate.doExecuteSubject(KerberosRestTemplate.java:202) at org.springframework.security.kerberos.client.KerberosRestTemplate.access$100(KerberosRestTemplate.java:67) at org.springframework.security.kerberos.client.KerberosRestTemplate$1.run(KerberosRestTemplate.java:191) at java.security.AccessController.doPrivileged(Native Method) at javax.security.auth.Subject.doAs(Subject.java:360) at org.springframework.security.kerberos.client.KerberosRestTemplate.doExecute(KerberosRestTemplate.java:187) ... 18 more

    Users with the same issue

    Unknown visitor1 times, last one,
    Unknown visitor1 times, last one,
    osvzs
    9 times, last one,
    tvrmsmith
    5 times, last one,
    batwalrus76
    27 times, last one,
    118 more bugmates