Java 执行期间的改装异常

Java 执行期间的改装异常,java,retrofit,Java,Retrofit,我是java开发新手,尝试学习改型api我遇到了一个异常,有人能帮我吗?我已经在下面粘贴了我的代码和输出异常,请看一下 谢谢, package com.company; import com.sun.deploy.util.SessionState; import retrofit.Callback; import retrofit.RestAdapter; import retrofit.RetrofitError; import retrofit.c

我是java开发新手,尝试学习改型api我遇到了一个异常,有人能帮我吗?我已经在下面粘贴了我的代码和输出异常,请看一下 谢谢,

package com.company;

    import com.sun.deploy.util.SessionState;
    import retrofit.Callback;
    import retrofit.RestAdapter;
    import retrofit.RetrofitError;
    import retrofit.client.Client;
    import retrofit.client.Request;
    import retrofit.client.Response;

    import java.io.IOException;

    public class Main {

        public static void main(String[] args) {
        // write your code here

            RetrofitInterface retrofitInterface = (RetrofitInterface)new RestAdapter.Builder().setEndpoint("http://localhost:8080/new_pro").build().create(RetrofitInterface.class);
            retrofitInterface.getUser(222, new Callback<String>() {
                @Override
                public void success(String s, Response response) {
                    //System.out.print(s);
                }

                @Override
                public void failure(RetrofitError retrofitError) {

                }
            });
        }
    }
package.com公司;
导入com.sun.deploy.util.SessionState;
进口改装.回收;
进口改装.RestAdapter;
导入改装。改装错误;
导入reformation.client.client;
导入改装.client.Request;
导入reformation.client.Response;
导入java.io.IOException;
公共班机{
公共静态void main(字符串[]args){
//在这里编写代码
RefughtInterface RefughtInterface=(RefughtInterface)new RestAdapter.Builder().setEndpoint(“http://localhost:8080/new_pro“”.build().create(interface.class);
getUser(222,新的回调函数(){
@凌驾
public void成功(字符串s,响应){
//系统输出打印;
}
@凌驾
公共无效故障(改型错误改型错误){
}
});
}
}
输出

Exception in thread "main" java.lang.IllegalArgumentException: RetrofitInterface.getUser: Must have return type or Callback as last argument, not both.
    at retrofit.RestMethodInfo.methodError(RestMethodInfo.java:107)
    at retrofit.RestMethodInfo.parseResponseType(RestMethodInfo.java:267)
    at retrofit.RestMethodInfo.<init>(RestMethodInfo.java:97)
    at retrofit.RestAdapter.getMethodInfo(RestAdapter.java:213)
    at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:236)
    at com.sun.proxy.$Proxy0.getUser(Unknown Source)
    at com.company.Main.main(Main.java:19)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:483)
    at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
线程“main”java.lang.IllegalArgumentException:RefughtInterface.getUser:中的异常必须具有返回类型或回调作为最后一个参数,而不是两者。 在Reformation.RestMethodInfo.methodError(RestMethodInfo.java:107)中 在reformation.RestMethodInfo.parseResponseType(RestMethodInfo.java:267)中 RestMethodInfo.(RestMethodInfo.java:97) 在reformation.RestAdapter.getMethodInfo(RestAdapter.java:213)中 在reformation.RestAdapter$RestHandler.invoke(RestAdapter.java:236)处 位于com.sun.proxy.$Proxy0.getUser(未知源) 位于com.company.Main.Main(Main.java:19) 在sun.reflect.NativeMethodAccessorImpl.invoke0(本机方法)处 位于sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) 在sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)中 位于java.lang.reflect.Method.invoke(Method.java:483) 位于com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
我以前使用的界面

public interface RetrofitInterface {
    // asynchronously with a callback
    @GET("/")
    Header getUser(@Query("user_id") int userId, Callback<Header> callback);
}
公共接口{
//与回调异步
@获取(“/”)
标题getUser(@Query(“user_id”)int userId,回调);
}
修改后的界面,我正在使用和工作

public interface RetrofitInterface {
    // asynchronously with a callback
    @GET("/")
    void getUser(@Query("user_id") int userId, Callback<Header> callback);
} 
公共接口{
//与回调异步
@获取(“/”)
void getUser(@Query(“user_id”)int userId,回调);
}