Unable to find RestTemplate Class in Maven dependencies
<p>I have faced a very big problem the past two months in that I am using Spring Android in Eclipse with Maven dependencies, but there is an error,</p>

<blockquote>
  <p>NoClassDefFound: org.springframework.web.client.RestTemplate.</p>
</blockquote>

<p>But I can't find the source of this error. What is it?</p>

<p>Error:</p>

<pre><code>06-03 12:46:44.102: ERROR/AndroidRuntime(1265): FATAL EXCEPTION: main
06-03 12:46:44.102: ERROR/AndroidRuntime(1265): java.lang.NoClassDefFoundError: org.springframework.web.client.RestTemplate
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at com.ex.newRest.newRest.onCreate(newRest.java:20)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1047)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:1611)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:1663)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at android.app.ActivityThread.access$1500(ActivityThread.java:117)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at android.app.ActivityThread$H.handleMessage(ActivityThread.java:931)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at android.os.Handler.dispatchMessage(Handler.java:99)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at android.os.Looper.loop(Looper.java:123)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at android.app.ActivityThread.main(ActivityThread.java:3683)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at java.lang.reflect.Method.invokeNative(Native Method)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at java.lang.reflect.Method.invoke(Method.java:507)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:839)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:597)
06-03 12:46:44.102: ERROR/AndroidRuntime(1265):     at dalvik.system.NativeStart.main(Native Method)
</code></pre>

<p>Code:</p>

<pre><code>package com.ex.newRest;
import org.springframework.web.client.RestTemplate;

import android.app.Activity;
import android.os.Bundle;

public class newRest extends Activity {
    /** Called when the activity is first created. */

    String postalCode;
    String countryCode;
    String radius;
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);

        RestTemplate restTemplate = new RestTemplate();
            // The HttpComponentsClientHttpRequestFactory uses the
            // org.apache.http package to make network requests.

            // restTemplate.setRequestFactory(new HttpComponentsClientHttpRequestFactory());

            // The URL for making the GET request.
            final String url = "http://ws.geonames.org/findNearbyPostalCodesJSON?postalcode={postalCode}&amp;country={countryCode}&amp;radius={radius}";

            String result = restTemplate.getForObject(url, String.class);
            System.out.println("Response-&gt;"+result);
            // Initiate the HTTP GET request, expecting an array of State
            // objects in response.
            //PostalCodes result = restTemplate.getForObject(
            //                        url, PostalCodes.class, this.postalCode, this.countryCode,
            //this.radius);
    }
}
</code></pre>
