title: org.springframework.web.client.HttpServerErrorException: 500 Internal Server Error
body: <p>I am getting the below error while running through linux script. This is not happening always sometimes it succeeded and sometimes the below error.:</p>
  
  <blockquote>
    <p>org.springframework.web.client.HttpServerErrorException: 500 Internal
    Server Error
            at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:78)
            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.getForObject(RestTemplate.java:199)
            at com.gtech.lsp.utils.SynchronizeRetailerData.main(SynchronizeRetailerData.java:42)
    Exception in thread "main"
    org.springframework.web.client.HttpServerErrorException: 500 Internal
    Server Error
            at org.springframework.web.client.DefaultResponseErrorHandler.handleError(DefaultResponseErrorHandler.java:78)
            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.getForObject(RestTemplate.java:199)</p>
  </blockquote>
  
  <p>I am initializing the <code>RestTemplate</code> as below:</p>
  
  <pre><code>url = PreferencesUtil.getInstance().getAppRoot()
                  .get("lsp.sync.retailer.url", "http://localhost:8080/lsptx/public/syncRetailer");
          restTemplate = new RestTemplate();          
          restTemplate.getForObject(url, String.class, jurId);
  </code></pre>
  
  <p>could you please help me on this?</p>