1

我是这个论坛的新手,也是android的java开发。我正在尝试使用 Spring 设置与服务的 REST 连接,但不断出现以下错误:

java.lang.VerifyError: org/springframework/http/converter/json/MappingJacksonHttpMessageConverter

这是我写的代码。谁能帮帮我?

public ArrayList<Employee> getAllEmployees(){
    ResponseEntity<EmployeeContainer> responseEntity = null;
    RestTemplate restTemplate = new RestTemplate();
    restTemplate.getMessageConverters().add(new MappingJacksonHttpMessageConverter());

    responseEntity =  restTemplate.exchange(BASE_URL + "employee", HttpMethod.GET, getRequestEntity(), EmployeeContainer.class);
    return responseEntity.getBody().getEmployees();
}

这是我的堆栈,我使用的是 Android Studio 0.2

10-15 12:37:42.983  25836-25854/com.project.sandbox2 E/AndroidRuntime﹕ FATAL EXCEPTION: AsyncTask #1
java.lang.RuntimeException: An error occured while executing doInBackground()
        at android.os.AsyncTask$3.done(AsyncTask.java:299)
        at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
        at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
        at java.util.concurrent.FutureTask.run(FutureTask.java:239)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:856)
 Caused by: java.lang.VerifyError: org/springframework/http/converter/json/MappingJacksonHttpMessageConverter
        at com.project.sandbox2.EmployeeService.getAllEmployees(EmployeeService.java:36)
        at com.project.sandbox2.RestTask.doInBackground(RestTask.java:19)
        at com.project.sandbox2.RestTask.doInBackground(RestTask.java:12)
        at android.os.AsyncTask$2.call(AsyncTask.java:287)
        at java.util.concurrent.FutureTask.run(FutureTask.java:234)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
        at java.lang.Thread.run(Thread.java:856)
10-15 12:37:43.143      304-524/system_process W/ActivityManager﹕ Force finishing      activity com.project.sandbox2/.MainActivity
10-15 12:37:43.235      304-524/system_process W/WindowManager﹕ Failure taking     screenshot for (328x583) to layer 21010
10-15 12:37:43.483       36-190/? E/SurfaceFlinger﹕ ro.sf.lcd_density must be defined as a build property
10-15 12:37:43.533        36-36/? E/SurfaceFlinger﹕ ro.sf.lcd_density must be defined as a build property
10-15 12:37:44.793      304-404/system_process E/ThrottleService﹕ problem during  onPollAlarm: java.lang.IllegalStateException: problem parsing stats:  java.io.FileNotFoundException: /proc/net/xt_qtaguid/iface_stat_all: open failed: ENOENT (No  such file or directory)
10-15 12:37:46.583      407-409/com.android.phone D/dalvikvm﹕ GC_CONCURRENT freed 385K,  18% free 2913K/3548K, paused 5ms+6ms, total 54ms
4

1 回答 1

1

一旦使用这些AsyncTaskmanifest文件检查问题permissions,或者:

  1. 检查您的resource xmldrawable是否正确配置以获得输出,..

  2. 我也遇到了同样的错误lib files,上面的过程消失了,..

  3. 并检查您正在做的事情HTTPHTTPS

于 2013-12-06T06:22:38.087 回答