• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

RPC fails after working couple of times.

 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

I'm using Windows 7 Eclipse Juno with the latest Google App Engine plugin.
I'm trying to write a program to check I understand how to store things in the Google App Engine datastore and also how to use GWT RPC.

The program has 2 text boxes for entering a name and address.
See the following image.


The name and address values are placed in a object called ContactDetails which is kept in the shared directory.
They are passed to to the datastore using GWT RPC and placed in a Entity kind called storedcontact.
The image below shows my directory structure.

The Image below shows the values getting stored in the development datastore.

Once in the datastore the I retrieve all the names and addresses from the datastore
Then I return them back to client side via the GWT RPC and display them in a flex table as shown below

The problem is it works a couple of times and then it fails.
I put in some system.out.println statements in an effort to diagnose the problem.
Below is the console display:


I can't understand why it will work twice and then fail?
below is my code.







 
Bartender
Posts: 11497
19
Android Google Web Toolkit Mac Eclipse IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

The stack trace is telling you that the array you initialized does not have sufficient capacity to add more data. Check the array size and the element size in your result.
 
Laurence Turpin
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Manesh Godbole for replying to my problem.
If you look at the code for RpcServiceImpl.storeContact method line 39 you will see that I have already printed the array size to the console

Each time I enter a new set of values the array is incremented to a larger size as you can see in the stack trace lines 12, 15, and 19
I have repeated the what I have sent to the console below

Note that in the last name and address I entered is Phil Mitchell 7 Albert Square
He appears to be in the datastore and the array is set for 3 entitys
So why is he not in the result? This is the problem
The following 3 lines give me the array size and display the array size to the console. These three lines appear to be working

Why is Phil Mitchell in the datastore and is counted as in the datastore, but the for loop cannot find him?
 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try switching over to ArrayList<ContactDetails> instead, it appears the source you are getting your count from is not giving you the real number of records perhaps? With an ArrayList, you just use #add(member) as needed, and you don't have to worry about adding past end of array.


 
Laurence Turpin
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Micheal Joyner for your reply my program now works.
I had to make a few additional changes to the Rpc return types.
I have shown the new code below.



The addToTable method also needed changing too as shown below
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic