0

こんにちは、ドメイン内の最初の 100 人のユーザーを JPA を使用してテーブルに格納するために使用されるアプリケーションを 1 つ試しましたが、サーバー エラーが返されました。助けて。これは私が試したコードです..

         public class AppsProvisioning {
       public String m[]=new String[1000];
  public int a;
  final EntityManager em = EMFService.get().createEntityManager();
//public static void main(String[] args)
 public void calluser() throws AppsForYourDomainException, ServiceException,    
  {

  try {

    // Create a new Apps Provisioning service
    UserService myService = new UserService("My Application");
    myService.setUserCredentials("admin@xxxx.edu.in","xxxxxxxx");

    // Get a list of all entries
    URL metafeedUrl = new URL("https://www.google.com/a/feeds/domain/user/2.0/");
    System.out.println("Getting user entries...\n");
    UserFeed resultFeed = myService.getFeed(metafeedUrl, UserFeed.class);
    List<UserEntry> entries = resultFeed.getEntries();
    for(int i=0; i<entries.size(); i++) {

      UserEntry entry = entries.get(i);
      m[i]=entry.getTitle().getPlainText();
      table greeting1 = new table(m[i]);
      em.persist(greeting1);
      System.out.println("\t" + entry.getTitle().getPlainText());
    }


    a=entries.size();
    System.out.println("\nTotal Entries: "+entries.size());
    }


  catch(AuthenticationException e) {
    e.printStackTrace();
  }
  catch(MalformedURLException e) {
    e.printStackTrace();
  }
  catch(ServiceException e) {
    e.printStackTrace();
  }
  catch(IOException e) {
    e.printStackTrace();
  }
  finally
  {    
   em.close();
  }
}

}

em.close() エラーのエラーは次のとおりだと思います: サーバー エラー サーバーでエラーが発生し、要求を完了できませんでした。よろしくシャルン

4

1 に答える 1

0

フィードURL(https://www.google.com/a/feeds/domain/user/2.0/)の「domain」をドメイン「xxxx.edu.in」に置き換えます。

別の方法として、リファレンスガイドhttp://code.google.com/googleapps/domain/gdata_provisioning_api_v2.0_reference_java.htmlで説明されているように、AppsForYourDomainClient.retrieveAllUsers()を使用します。

于 2011-09-02T20:35:55.830 に答える