CSSG
CSSG

Reputation: 39

How to use RestClientException catch in Android

I have one Rest Web Service and I am using this web service from the below code of android.

The web service is working fine I have test that.

But in the below code I am getting error

  String url ="http://10.0.2.2:29512/Restweb_2/webresources/generic/shirish";

  RestTemplate resttemplate = new RestTemplate();
    Log.v("in1", "in1");
 resttemplate.getMessageConverters().add(new StringHttpMessageConverter());
    Log.v("in2", "in2");
   String result;
        try {            
            result = resttemplate.getForObject(url,String.class);
        } 
        catch (RestClientException ex) {
           ![I am getting this error while using this exception and I am not able to proceed further if I don't use this exception(Or it is giving me error in result assign statment)][1]. So how to use RestClient!Exception ????? Also I already import the needed jar files.

        }

Upvotes: 3

Views: 1229

Answers (1)

AshleyJ
AshleyJ

Reputation: 332

incompatible type required throwable found RestClientException

This can be caused when you've included the spring-android-rest-template-xxxx.jar and haven't included the spring-android-core-xxxx.jar

Upvotes: 5

Related Questions