2016-06-11 4 views
0

私はazureを初めて使ったので、SQLデータベース(.NETバックエンド)を持つressourceグループを作成しました。また、私はMigrationsを使用しています。Azure MobileServiceException:{"message": "エラーが発生しました。"}

BACKEND:私はバックエンドでクラスUserを追加

public SbSet<User> User { get; set; } 

FRONTEND:

私は私のコンテキストにクラスを追加
public class User: EntityData 
{ 
    [Required, StringLength(128)] 
    public String pseudo { get; set; } 
    public String name { get; set; } 
    public String familyName { get; set; } 
    public String email { get; set; } 
    public String hobbies { get; set; } 
    public String favoriteTrips { get; set; } 
    public String comment { get; set; } 
    public String password { get; set; } 
    public String img { get; set; } 
    public float note { get; set; } 
    public int bday { get; set; } 
    public List<String> languages { get; set; } 
} 

ここ

は私のクラスUserです:

public class User implements Serializable { 
    public String Id; 
    public String pseudo, name, familyName, email, hobbies, favoriteTrips, comment; 
    public float note; 
    public int bday; 
    public ArrayList<String> languages; 
    public String img; 
    public String password; 

    // Constructors and Methods 
} 

そして、ここでは、私はデータベースにアクセスしようとする方法である:

Runnable r = new Runnable() 
{ 
    @Override 
    public void run() { 
     try { 
      mClient = new MobileServiceClient(SERVER_LINK, this); 
      // insert the user 
      User user = new User(...) 
      User user2 = mClient.getTable(User.class).insert(user).get(); 
      System.out.println("Inserted user with ID = " + user2.getId()); 

      // get all users 
      List<User> users = mClient.getTable(User.class).execute().get(); 
      System.out.println("List length : " + users.size()); 
      for (User u: users) 
      { 
       System.out.println(u.getId() + ": " + u.getPseudo()); 
      } 
     } catch (Exception e) { 
      System.out.println("FAILED AGAIN !!!!!!!!!!!!!!!!!!!!!!!!!!"); 
      e.printStackTrace(); 
     } 
    } 
}; 

Thread t = new Thread(r); 
t.start(); 

結果:

06-11 02:24:38.793 13739-13739/t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86 
    06-11 02:24:39.189 13739-13739/t2g.com.travel2gather W/System: ClassLoader referenced unknown path: /data/app/t2g.com.travel2gather-1/lib/x86 
    06-11 02:24:39.393 13739-13745/t2g.com.travel2gather W/art: Suspending all threads took: 48.807ms 
    06-11 02:24:40.029 13739-13739/t2g.com.travel2gather W/art: Before Android 4.1, method android.graphics.PorterDuffColorFilter android.support.graphics.drawable.VectorDrawableCompat.updateTintFilter(android.graphics.PorterDuffColorFilter, android.content.res.ColorStateList, android.graphics.PorterDuff$Mode) would have incorrectly overridden the package-private method in android.graphics.drawable.Drawable 
    06-11 02:24:40.290 13739-13778/t2g.com.travel2gather D/OpenGLRenderer: Use EGL_SWAP_BEHAVIOR_PRESERVED: true 

    [ 06-11 02:24:40.291 13739:13739 D/   ] 
    HostConnection::get() New Host Connection established 0xabfea2e0, tid 13739 


    [ 06-11 02:24:40.333 13739:13778 D/   ] 
    HostConnection::get() New Host Connection established 0xb40dcf00, tid 13778 
    06-11 02:24:40.342 13739-13778/t2g.com.travel2gather I/OpenGLRenderer: Initialized EGL, version 1.4 
    06-11 02:24:40.366 13739-13778/t2g.com.travel2gather W/EGL_emulation: eglSurfaceAttrib not implemented 
    06-11 02:24:40.366 13739-13778/t2g.com.travel2gather W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xb40a0be0, error=EGL_SUCCESS 
    06-11 02:24:40.408 13739-13745/t2g.com.travel2gather W/art: Suspending all threads took: 67.225ms 
    06-11 02:24:40.431 13739-13768/t2g.com.travel2gather W/art: Verification of void com.squareup.okhttp.internal.http.HttpEngine.sendRequest() took 242.139ms 
    06-11 02:24:40.450 13739-13749/t2g.com.travel2gather I/art: Background partial concurrent mark sweep GC freed 8675(1549KB) AllocSpace objects, 2(40KB) LOS objects, 39% free, 2MB/3MB, paused 4.360ms total 160.861ms 
    06-11 02:24:41.376 13739-13767/t2g.com.travel2gather I/System.out: FAILED AGAIN !!!!!!!!!!!!!!!!!!!!!!!!!! 
    06-11 02:24:41.376 13739-13767/t2g.com.travel2gather W/System.err: java.util.concurrent.ExecutionException: com.microsoft.windowsazure.mobileservices.MobileServiceException: {"message":"An error has occurred."} 
    06-11 02:24:41.376 13739-13767/t2g.com.travel2gather W/System.err:  at com.google.common.util.concurrent.AbstractFuture$Sync.getValue(AbstractFuture.java:299) 
    06-11 02:24:41.376 13739-13767/t2g.com.travel2gather W/System.err:  at com.google.common.util.concurrent.AbstractFuture$Sync.get(AbstractFuture.java:286) 
    06-11 02:24:41.376 13739-13767/t2g.com.travel2gather W/System.err:  at com.google.common.util.concurrent.AbstractFuture.get(AbstractFuture.java:116) 
    06-11 02:24:41.376 13739-13767/t2g.com.travel2gather W/System.err:  at t2g.com.travel2gather.NavDrawer$1.run(NavDrawer.java:95) 
    06-11 02:24:41.376 13739-13767/t2g.com.travel2gather W/System.err:  at java.lang.Thread.run(Thread.java:818) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err: Caused by: com.microsoft.windowsazure.mobileservices.MobileServiceException: {"message":"An error has occurred."} 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err:  at com.microsoft.windowsazure.mobileservices.http.MobileServiceConnection$1.onNext(MobileServiceConnection.java:128) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err:  at com.microsoft.windowsazure.mobileservices.MobileServiceClient$15.handleRequest(MobileServiceClient.java:1499) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err:  at com.microsoft.windowsazure.mobileservices.http.MobileServiceConnection.start(MobileServiceConnection.java:113) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err:  at com.microsoft.windowsazure.mobileservices.http.RequestAsyncTask.doInBackground(RequestAsyncTask.java:78) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err:  at com.microsoft.windowsazure.mobileservices.http.RequestAsyncTask.doInBackground(RequestAsyncTask.java:35) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err:  at android.os.AsyncTask$2.call(AsyncTask.java:295) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err:  at java.util.concurrent.FutureTask.run(FutureTask.java:237) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err:  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err:  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588) 
    06-11 02:24:41.377 13739-13767/t2g.com.travel2gather W/System.err: ... 1 more 
    06-11 02:36:13.521 13739-13745/t2g.com.travel2gather W/art: Suspending all threads took: 8.356ms 

私はどこ理解していませんこのエラーは、最初に発生します.get()insert(user).get()またはexecute().get())。ご協力いただきありがとうございます。

EDIT:また、データベースへのアクセスは、サンプルテーブルTodoItemで正常に動作しますので、エラーが私のクラスから来てUser

答えて

0

Androidのコードとはっきりしない例外情報によると、私はあると思いますように見えることに注意してくださいtutorialsampleを参考にして慎重に確認することをお勧めします。 Userクラスの

  1. 特性は、プロパティIdため@com.google.gson.annotations.SerializedName("id")として注釈宣言が、欠落しています。
  2. UserクラスはPOJOクラスであり、Serializableインターフェイスを実装するためには必要ありません。
  3. 挿入操作を実行するための新しいスレッドを作成する必要はないようです。私はこれを行う理由を理解していない。

希望します。

関連する問題