Hello I tried one application which is used to store First 100 users in my domain to the table using JPA.But its returning Server Error. Pealse Help me. This is the code i tried..
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();
}
}
}
I think error in em.close() Error is:Server Error The server encountered an error and could not complete your request. Regards Sharun