The objects were actually being saved, problem was my way of querying,
I still get the exception but everything is working.

Thanks Jason.

On Sep 14, 5:43 pm, "Jason (Google)" <apija...@google.com> wrote:
> Also, do you have any unit tests that touch the App Engine datastore, and if
> so, can you run these to see if they work?
>
> - Jason
>
>
>
> On Mon, Sep 14, 2009 at 3:41 PM, Jason (Google) <apija...@google.com> wrote:
> > Your code looks fine. I just copied it over to a non-Spring context and it
> > worked without a hitch. Did you see this error before upgrading your SDK?
> > Are you seeing it in both the local development server and production? If
> > you start a new project and copy over your domain and DAO classes, does it
> > work?
>
> > - Jason
>
> > On Fri, Sep 11, 2009 at 2:04 PM, cancunmods <archie.she...@gmail.com>wrote:
>
> >> Hi, I am using spring in my application and the pmf is a singleton, I
> >> put it in the class just to make sure it is not a spring issue. I am
> >> still getting the error but in my case nothing is persisted. I also
> >> added the @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY)
> >> line and no dice my SDK version is the newest 1.2.5. The following is
> >> the spring code from which I am calling the saveUser method I had
> >> posted before. Any help would be greatly appreciaed, thanks.
>
> >> package subasta.web.users;
>
> >> import org.springframework.beans.propertyeditors.StringTrimmerEditor;
> >> import org.springframework.web.bind.ServletRequestDataBinder;
> >> import org.springframework.web.servlet.mvc.SimpleFormController;
> >> import org.springframework.web.servlet.ModelAndView;
> >> import org.springframework.web.servlet.view.RedirectView;
> >> import org.springframework.beans.factory.annotation.Autowired;
>
> >> import subasta.domain.users.User;
>
> >> import javax.servlet.ServletException;
> >> import javax.servlet.http.HttpServletRequest;
>
> >> import java.util.logging.Logger;
>
> >> import subasta.service.users.GuardaUsuario;
> >> import subasta.repository.users.UserDAO;
>
> >> public class RegisterController extends SimpleFormController {
> >>         /** Logger for this class and subclasses */
> >>        private static final Logger log = Logger.getLogger
> >> (RegisterController.class
> >>                        .getName());
>
> >>        private UserDAO userDao;
>
> >>        public void setUserDao(UserDAO userDao) {
> >>                this.userDao = userDao;
> >>        }
>
> >>       �...@override
> >>        public ModelAndView onSubmit(Object command) throws
> >> ServletException
> >> {
>
> >>                String nombre = ((GuardaUsuario) command).getNombre();
> >>                log.info("Guardando usuario " + nombre + ".");
>
> >>                User user = new User(nombre);
> >>                userDao.saveUser(user);
>
> >>                log.info("returning from RegisterController view to "
> >>                                + getSuccessView());
>
> >>                return new ModelAndView(new
> >> RedirectView(getSuccessView()));
> >>        }
>
> >>        /*
> >>         * This was added because after uploading to GAE I was getting an
> >> exception, it is
> >>         * actually a pretty neat addition, taken from its javadoc:
> >>         * Property editor that trims Strings. Optionally allows
> >> transforming
> >> an empty string into a null value. Needs to be explictly registered,
> >> e.g. for command binding.
> >>         * @see
> >> org.springframework.web.servlet.mvc.BaseCommandController#initBinder
> >> (javax.servlet.http.HttpServletRequest,
> >> org.springframework.web.bind.ServletRequestDataBinder)
> >>         */
> >>       �...@override
> >>        protected void initBinder(HttpServletRequest request,
> >>                        ServletRequestDataBinder binder) throws Exception {
> >>                binder.registerCustomEditor(String.class,
> >>                                new StringTrimmerEditor(false));
> >>         }
> >> }
>
> >> On Sep 11, 3:31 pm, Jeff <j...@jgyoung.com> wrote:
> >> > I've been seeing the same thing, and also only on the first access
> >> > after application start.  It happens consistently for me with my first
> >> > call to either getObjectById makePersistent or makePersistentAll.  In
> >> > my attempts to search the web for info, I ran across a snippet of code
> >> > that included the specified error message text.  A comment in that
> >> > source said something like "this is a harmless exception, we should
> >> > figure out a way to suppress it."  Yeah, I was annoyed at having spent
> >> > a bunch of time thinking this was the source of an issue when it was
> >> > only a red herring.  Sorry I don't remember the url to that code
> >> > snippet but searching for pieces of the error message from the
> >> > beginning of your stack trace should eventually find it.
>
> >> > I'm currently choosing to ignore the exception and everything appears
> >> > to be working for me.
>
> >> > On Sep 11, 12:01 pm, "Jason (Google)" <apija...@google.com> wrote:
>
> >> > > You shouldn't need the @Persistent(valueStrategy =
> >> > > IdGeneratorStrategy.IDENTITY) line since you're using a key name and
> >> not a
> >> > > String-encoded ID.
>
> >> > > The only thing that looks suspicious is your pmf object. The best
> >> practice
> >> > > is to use a PersistenceManagerFactory singleton as documented
> >> athttp://code.google.com/appengine/docs/java/datastore/usingjdo.html#Ge..
> >> .,
> >> > > but I would expect to see exceptions with subsequent calls to
> >> saveUser, not
> >> > > the first call. All the same, I recommend you try this to see if it
> >> helps,
> >> > > and please also let me know which version of the SDK you're using.
>
> >> > > - Jason
>
> >> > > On Thu, Sep 10, 2009 at 1:09 AM, bysse <erik.byst...@gmail.com>
> >> wrote:
>
> >> > > > As expected, this has nothing to do with wicket or sessions, just to
> >> > > > be sure i've checked those. If fact, all entities get persisted as
> >> > > > they should and the exception is caught somewhere in makePersistent.
> >> > > > So as far as i know, no harm is done(?)
> >> > > > So i think i'll just ignore this stacktrace and continue as usual.
>
> >> > > > On Sep 10, 12:22 am, bysse <erik.byst...@gmail.com> wrote:
> >> > > > > I also get this exception, but only on the first call to
> >> > > > > makePersistent.
>
> >> > > > > First Call:
> >> > > > >   Exception
> >> > > > >   Store objects ?
> >> > > > > Later Calls
> >> > > > >   Ok
> >> > > > >   Stores objects
>
> >> > > > > Can't think of anything that causes this. I'm using Wicket, how
> >> about
> >> > > > > you?
>
> >> > > > > /Erik
>
> >> > > > > On Sep 8, 7:48 pm, cancunmods <archie.she...@gmail.com> wrote:
>
> >> > > > > > I am having trouble saving an object on google app engine. Here
> >> is my
> >> > > > > > POJO class:
>
> >> > > > > > package subasta.domain.users;
>
> >> > > > > > import javax.jdo.annotations.IdentityType;
> >> > > > > > import javax.jdo.annotations.PersistenceCapable;
> >> > > > > > import javax.jdo.annotations.PrimaryKey;
> >> > > > > > import javax.jdo.annotations.Persistent;
>
> >> > > > > > @PersistenceCapable(identityType = IdentityType.APPLICATION)
> >> > > > > > public class User {
> >> > > > > >     @PrimaryKey
> >> > > > > >     @Persistent
> >> > > > > >     private String nombre;
>
> >> > > > > >     public User(String nombre){
> >> > > > > >         this.nombre = nombre;
> >> > > > > >     }
>
> >> > > > > >     public String getNombre() {
> >> > > > > >         return nombre;
> >> > > > > >     }
>
> >> > > > > >     public void setNombre(String nombre) {
> >> > > > > >         this.nombre = nombre;
> >> > > > > >     }
>
> >> > > > > > }
>
> >> > > > > > Here is my JDO Code.:
>
> >> > > > > > package subasta.repository.users;
>
> >> > > > > > import java.util.Set;
> >> > > > > > import java.util.logging.Logger;
>
> >> > > > > > import javax.jdo.JDOHelper;
> >> > > > > > import javax.jdo.PersistenceManagerFactory;
> >> > > > > > import javax.jdo.PersistenceManager;
>
> >> > > > > > import subasta.domain.users.User;
>
> >> > > > > > public class JDOUserDAO implements UserDAO{
> >> > > > > >     /** Logger for this class and subclasses */
> >> > > > > >     private static final Logger log =
> >> Logger.getLogger(UserDAO.class
> >> > > > > >             .getName());
>
> >> > > > > >     private static final PersistenceManagerFactory pmf =
> >> > > > > >         JDOHelper.getPersistenceManagerFactory("transactions-
> >> > > > > > optional");
>
> >> > > > > >     //PersistenceManagerFactory pmf;
>
> >> > > > > >     //public void setPmf(PersistenceManagerFactory pmf) {
> >> > > > > >         //this.pmf = pmf;
> >> > > > > >     //}
>
> >> > > > > >     public void saveUser(User user){
> >> > > > > >         PersistenceManager pm = pmf.getPersistenceManager();
> >> > > > > >         try{
> >> > > > > >             pm.makePersistent(user);
> >> > > > > >         }finally {
> >> > > > > >             pm.close();
> >> > > > > >         }
> >> > > > > >     }
>
> >> > > > > >     @SuppressWarnings("unchecked")
> >> > > > > >     public Set<User> getUsers(){
> >> > > > > >         PersistenceManager pm = pmf.getPersistenceManager();
> >> > > > > >         Set<User> users = (Set<User>)pm.getManagedObjects
> >> > > > > > (User.class);
> >> > > > > >         pm.close();
> >> > > > > >         return users;
> >> > > > > >     }
>
> >> > > > > > }
>
> >> > > > > > Things go wrong when making the call tomakePersistent. The
> >> exception
> >> > > > > > is:
>
> >> > > > > > 08-sep-2009 16:51:35
>
> >> com.google.appengine.repackaged.com.google.common.base.FinalizableReference
> >> ­Queue
> >> > > > > > <init>
> >> > > > > > INFO: Failed to start reference finalizer thread. Reference
> >> cleanup
> >> > > > > > will only occur when new references are created.
> >> > > > > > java.lang.reflect.InvocationTargetException
> >> > > > > >     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> >> Method)
> >> > > > > >     at sun.reflect.NativeMethodAccessorImpl.invoke
> >> > > > > > (NativeMethodAccessorImpl.java:39)
> >> > > > > >     at
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google App Engine for Java" group.
To post to this group, send email to google-appengine-java@googlegroups.com
To unsubscribe from this group, send email to 
google-appengine-java+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to