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 sun.reflect.DelegatingMethodAccessorImpl.invoke > > > > > (DelegatingMethodAccessorImpl.java:25) > > > > > at java.lang.reflect.Method.invoke(Method.java:597) > > > > > at > > > > com.google.appengine.repackaged.com.google.common.base.FinalizableReference > > > Queue.<init> > > > > > (FinalizableReferenceQueue.java:124) > > > > > at > > > > com.google.appengine.repackaged.com.google.common.labs.misc.InterningPools > > > > > $WeakInterningPool.<clinit>(InterningPools.java:104) > > > > > at > > > > com.google.appengine.repackaged.com.google.common.labs.misc.InterningPools. > > > newWeakInterningPool > > > > > (InterningPools.java:48) > > > > > at > > > > com.google.appengine.repackaged.com.google.io.protocol.ProtocolSupport.<cli > > > nit> > > > > > (ProtocolSupport.java:55) > > > > > at com.google.apphosting.api.DatastorePb$PutRequest.freeze > > > > > (DatastorePb.java:8452) > > > > > at com.google.apphosting.api.DatastorePb$PutRequest$1.<init> > > > > > (DatastorePb.java:8367) > > > > > at com.google.apphosting.api.DatastorePb$PutRequest.<clinit> > > > > > (DatastorePb.java:8364) > > > > > at com.google.appengine.api.datastore.DatastoreServiceImpl.put > > > > > (DatastoreServiceImpl.java:152) > > > > > at com.google.appengine.api.datastore.DatastoreServiceImpl.put > > > > > (DatastoreServiceImpl.java:138) > > > > > at com.google.appengine.api.datastore.DatastoreServiceImpl.put > > > > > (DatastoreServiceImpl.java:130) > > > > > at > > > > org.datanucleus.store.appengine.RuntimeExceptionWrappingDatastoreService.pu > > > t > > > > > (RuntimeExceptionWrappingDatastoreService.java:93) > > > > > at org.datanucleus.store.appengine.DatastorePersistenceHandler.put > > > > > (DatastorePersistenceHandler.java:165) > > > > > at org.datanucleus.store.appengine.DatastorePersistenceHandler.put > > > > > (DatastorePersistenceHandler.java:112) > > > > > at > > > > org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObjects > > > > > (DatastorePersistenceHandler.java:239) > > > > > at > > > > org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject > > > > > (DatastorePersistenceHandler.java:225) > > > > > at > > > > > org.datanucleus.state.JDOStateManagerImpl.internalMakePersistent > > > > > (JDOStateManagerImpl.java:3185) > > > > > at org.datanucleus.state.JDOStateManagerImpl.makePersistent > > > > > (JDOStateManagerImpl.java:3161) > > > > > at org.datanucleus.ObjectManagerImpl.persistObjectInternal > > > > > (ObjectManagerImpl.java:1298) > > > > > at org.datanucleus.ObjectManagerImpl.persistObject > > > > > (ObjectManagerImpl.java:1175) > > > > > at org.datanucleus.jdo.JDOPersistenceManager.jdoMakePersistent > > > > > (JDOPersistenceManager.java:669) > > > > > at org.datanucleus.jdo.JDOPersistenceManager.makePersistent > > > > > (JDOPersistenceManager.java:694) > > > > > at subasta.repository.users.JDOUserDAO.saveUser(JDOUserDAO.java: > > > > > 29) > > > > > at subasta.web.users.RegisterController.onSubmit > > > > > (RegisterController.java:38) > > > > > at > > > > > org.springframework.web.servlet.mvc.SimpleFormController.onSubmit > > > > > (SimpleFormController.java:409) > > > > > at > > > > > org.springframework.web.servlet.mvc.SimpleFormController.onSubmit > > > > > (SimpleFormController.java:381) > > > > > at > > > > org.springframework.web.servlet.mvc.SimpleFormController.processFormSubmiss > > > ion > > > > > (SimpleFormController.java:267) > > > > > at > > > > org.springframework.web.servlet.mvc.AbstractFormController.handleRequestInt > > > ernal > > > > > (AbstractFormController.java:265) > > > > > at > > > > > org.springframework.web.servlet.mvc.AbstractController.handleRequest > > > > > (AbstractController.java:153) > > > > > at > > > > org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle > > > > > (SimpleControllerHandlerAdapter.java:48) > > > > > at org.springframework.web.servlet.DispatcherServlet.doDispatch > > > > > (DispatcherServlet.java:875) > > > > > at org.springframework.web.servlet.DispatcherServlet.doService > > > > > (DispatcherServlet.java:807) > > > > > at org.springframework.web.servlet.FrameworkServlet.processRequest > > > > > (FrameworkServlet.java:571) > > > > > at org.springframework.web.servlet.FrameworkServlet.doPost > > > > > (FrameworkServlet.java:511) > > > > > 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 -~----------~----~----~----~------~----~------~--~---