0
您好,我嘗試了一個應用程序,它用於將我的域中的First 100用戶存儲到使用JPA的表中,但它返回的Server Error。 Pealse幫助我。 這是我試過的代碼..使用Java的Provisioning Api
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("[email protected]","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() 錯誤是:服務器錯誤 服務器遇到錯誤,無法完成您的請求。 Registers Sharun
中說明可能是有幫助的顯示哪些線在代碼導致這個錯誤。 – 2010-06-02 08:46:21
發佈堆棧跟蹤 – crowne 2010-06-02 09:08:54