Spring RestTemplate Beginner: The request sent by the client was syntactically incorrect ()


i am trying to access a Rest Resource for which i am able to test using curl
id length should be 11 charecters
if id's length is less than 11 for example '12345'
https://somesite.com:7677/something/id/{id} iam getting 404 HTTP Error from my java code and curl which is as expected

if id's length is equal to 11 and it is invalid id
then iam getting the same responce from curl and java

but if i give the valid id which is alredy present by curl
i am getting proper json response but when iam trying to access the Rest resource from restTemplate it is showing the error as shown below

The request sent by the client was syntactically incorrect (). and there are no error logs for this request

Iam not able to figure it out from last 2 days, please provide your thoughts on this so that it will eb really help full for me
My rest template configuration:

<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
        <property name="messageConverters">
                <ref bean="jsonHttpMessageConverter" />

Code which from which iam trying to access is

public List<Account> getAccounts(PersonNumber personNumber) {
        logger.warn("Inside getAccounts of TransferAgreement client");

        String url = "https://somesite.com:7677/something/id/12345";
        logger.warn("URL acessing "+personNumber.toString()+"  URL  "+ url);
       String a = restTemplate.getForObject(url, String.class);
        return null;

Best Solution

Assume that you are using Eclipse.

Enable logging for Spring

  • set logging level to debug or trace for Spring, see Logging
  • run your java example
  • add the logging output to your post

I think that enabling logging is enough, I expect an exception within Spring. But additionally, test if a request is executed: