I started a new eclipse project, and the database now works without
any enums or lists.
However, I get the same error as in my first post when I use an
persistent enum like this:
Area.java:
import com.google.appengine.api.datastore.Key;
import javax.jdo.annotations.*;
@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Area{
        @PrimaryKey
        @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
        private Key key;
        @Persistent
        private String name;
        @Persistent
        private AreaType areaType;

AreaType.java:
import javax.jdo.annotations.PersistenceAware;
@PersistenceAware
public enum AreaType{
        TEST;
}

I also tried making AreaType serializable, and giving the areaType
field the javax.persistence.Enumerated annotation, but this didn't
change anything.
The warning logs:
org.datanucleus.store.exceptions.NoTableManagedException: Persistent
class "com.wander.wave.zombify.Area" has no table in the database, but
the operation requires it. Please check the specification of the
MetaData for this class.
at org.datanucleus.store.mapped.MappedStoreManager.getDatastoreClass
(MappedStoreManager.java:376)
at org.datanucleus.store.appengine.DatastoreManager.getDatastoreClass
(DatastoreManager.java:505)
at
org.datanucleus.store.appengine.DatastoreFieldManager.buildMappingConsumerForWrite
(DatastoreFieldManager.java:974)
at org.datanucleus.store.appengine.DatastoreFieldManager.<init>
(DatastoreFieldManager.java:136)
at org.datanucleus.store.appengine.DatastoreFieldManager.<init>
(DatastoreFieldManager.java:167)
at
org.datanucleus.store.appengine.DatastorePersistenceHandler.insertObject
(DatastorePersistenceHandler.java:178)
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 com.wander.wave.zombify.ZombifyServlet.executeCommand
(ZombifyServlet.java:65) //<--- manager.makePersistent(area);

Thanks alot for your help

On Aug 29, 3:39 am, Wander <[email protected]> wrote:
> For now for testing I removed most stuff and used another test servlet
> instead
> This is the servlet:
> package com.wander.wave.zombify;
> import java.io.IOException;
> import javax.jdo.*;
> import javax.servlet.http.*;
> public class TestServlet extends HttpServlet{
>         public void doGet(HttpServletRequest req,HttpServletResponse resp)
> throws IOException{
>                 PersistenceManager manager = 
> JDOHelper.getPersistenceManagerFactory
> ("transactions-optional").getPersistenceManager();
>                 Area area = new Area("Test");
>                 manager.makePersistent(area);
>         }
>
> }
>
> And this is Area:
> package com.wander.wave.zombify;
> import javax.jdo.annotations.*;
> import com.google.appengine.api.datastore.Key;
> @PersistenceCapable(identityType=IdentityType.APPLICATION)
> public class Area{
>         @PrimaryKey
>         @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
>         private Key key;
>         @Persistent
>         private String name;
>         public Area(String name){
>                 this.name = name;
>         }
>
> }
>
> When I visit the page thats mapped to the servlet, I get the same
> error
> Uncaught exception from servlet
> java.lang.NoClassDefFoundError: javax/jdo/metadata/TypeMetadata
>         at java.lang.Class.forName0(Native Method)
>         at java.lang.Class.forName(Unknown Source)
>         at
> com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_.lo 
> adClassOrStub
> (Class_.java:261)
>         at
> com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_.ac 
> cess
> $100(Class_.java:37)
>         at
> com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_
> $3.run(Class_.java:131)
>         at
> com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_
> $3.run(Class_.java:116)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at
> com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_.fo 
> rName
> (Class_.java:116)
>         at javax.jdo.JDOHelper$18.run(JDOHelper.java:2009)
>         at javax.jdo.JDOHelper$18.run(JDOHelper.java:2007)
>         at
> com.google.apphosting.runtime.security.shared.intercept.java.security.Acces 
> sController_.doPrivileged
> (AccessController_.java:45)
>         at javax.jdo.JDOHelper.forName(JDOHelper.java:2006)
>         at
> javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation
> (JDOHelper.java:1155)
>         at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
> 803)
>         at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
> 1086)
>         at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
> 914)
>         at com.wander.wave.zombify.TestServlet.doGet(TestServlet.java:10)//<--
> where i get the persistence manager
>         //etc
>
> I have the following JARs in war/WEB-INF/lib:
>  appengine-api-1.0-sdk-1.2.2.jar
>  datanucleus-appengine-1.0.2.final.jar
>  datanucleus-core-2.0.0.m1.jar
>  datanucleus-jpa-2.0.0.m1.jar
>  geronimo-jpa_3.0_spec-1.1.1.jar
>  geronimo-jta_1.1_spec-1.1.1.jar
>  jdo2-api-2.3-ea.jar
>  json.jar
>  jsonrpc.jar
>  wave-robot-api.jar
>
> Thank you very much for your help
>
> On Aug 28, 8:20 pm, "Jason (Google)" <[email protected]> wrote:
>
>
>
> > Can you list the JARs in your war/WEB-INF/lib directory?
> > Also, can you explain how you're dealing with the AreaType field? Can you
> > either remove this field entirely (for now) or make it a @PersistenceCapable
> > class rather than an enum for testing purposes?
>
> > Thanks,
> > - Jason
>
> > On Thu, Aug 27, 2009 at 1:45 PM, Wander <[email protected]> wrote:
>
> > > I just installed it here about a week ago, so I think I have the
> > > latest versions
> > > Im using the eclipse plugin, I use eclipse 3.5 (Galileo) on Ubuntu
> > > 9.04 (Jaunty)
> > > The appengine version is: 1.2.2.v200907291526
>
> > > Item is a class similar to Area, same annotations, similar fields,
> > > AreaType is an enum
> > > Area and Item have @PersistenceCapable
> > > (identityType=IdentityType.APPLICATION), AreaType has
> > > @PersistenceAware
> > > I found out that the endless loop only happens when I save a class/
> > > enum that has the @PersistenceAware annotation
> > > However, if I just switch to another class that doesn't have
> > > @PersistenceAware the loop ends, so I guess it's not a big problem
>
> > > To prevent the one-to-many bug between objects of the same type, in
> > > Area I replaced ArrayList<Area> borderAreas, by ArrayList<Keys>
> > > borderAreaKeys
>
> > > I'm not getting the "has no table in the database" warning anymore,
> > > now I get this:
>
> > > Nested in javax.servlet.ServletException: init:
> > > java.lang.NoClassDefFoundError: javax/jdo/metadata/TypeMetadata
> > >        at java.lang.Class.forName0(Native Method)
> > >        at java.lang.Class.forName(Unknown Source)
> > >        at
>
> > > com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_.lo
> > >  adClassOrStub
> > > (Class_.java:261)
> > >        at
>
> > > com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_.ac
> > >  cess
> > > $100(Class_.java:37)
> > >        at
> > > com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_
> > > $3.run(Class_.java:131)
> > >        at
> > > com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_
> > > $3.run(Class_.java:116)
> > >        at java.security.AccessController.doPrivileged(Native Method)
> > >        at
>
> > > com.google.apphosting.runtime.security.shared.intercept.java.lang.Class_.fo
> > >  rName
> > > (Class_.java:116)
> > >        at javax.jdo.JDOHelper$18.run(JDOHelper.java:2009)
> > >        at javax.jdo.JDOHelper$18.run(JDOHelper.java:2007)
> > >        at
>
> > > com.google.apphosting.runtime.security.shared.intercept.java.security.Acces
> > >  sController_.doPrivileged
> > > (AccessController_.java:45)
> > >        at javax.jdo.JDOHelper.forName(JDOHelper.java:2006)
> > >        at
> > > javax.jdo.JDOHelper.invokeGetPersistenceManagerFactoryOnImplementation
> > > (JDOHelper.java:1155)
> > >        at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
> > > 803)
> > >        at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
> > > 1086)
> > >        at javax.jdo.JDOHelper.getPersistenceManagerFactory(JDOHelper.java:
> > > 914)
> > >        at com.wander.wave.zombify.PMF.<clinit>(PMF.java:7)
> > >        at
> > > com.wander.wave.zombify.ZombifyServlet.<init>(ZombifyServlet.java:
> > > 11)  //<--- this is where I use, manager = PMF.get
> > > ().getPersistenceManager();
> > >        <!--etc-->
>
> > > Its still not inserting anything in the database, when I go to Data
> > > Viewer it says "No Data Yet."
> > > Any idea what can cause this?
>
> > > On Aug 27, 8:48 pm, "Jason (Google)" <[email protected]> wrote:
> > > > Are you using the Eclipse plugin? If so, what platform are you running?
> > > What
> > > > version of the SDK are you using?
> > > > As far as the first issue goes, are AreaType and Item also persistent
> > > > classes? Also, there appears to be a bug with owned one-to-many
> > > > relationships between objects of the same type, so if you're able to
> > > resolve
> > > > the initial error but you don't see any entities persisted, this is the
> > > > reason.
>
> > > > - Jason
>
> > > > On Wed, Aug 26, 2009 at 1:10 PM, Wander <[email protected]> wrote:
>
> > > > > I still haven't solved the problem above, a new one turned up however.
> > > > > Datanucleus keeps looping on forever as soon as I edit and save a
> > > > > class. Could this be related, and how can I solve it?
>
> > > > > Thanks
>
> > > > > On Aug 26, 5:09 am, Wander <[email protected]> wrote:
> > > > > > Hi all
>
> > > > > > I'm trying to use the datastore in app engine (for the first time),
> > > > > > but I get the following warning:
> > > > > > javax.jdo.JDOUserException: Persistent class
> > > "com.wander.etc.etc.Area"
> > > > > > has no table in the database, but the operation requires it. Please
> > > > > > check the specification of the MetaData for this class.
>
> > > > > > This is the piece of code:
> > > > > > PersistenceManager manager = PMF.get().getPersistenceManager();
> > > > > > Area area       = new Area("something",AreaType.OUTSIDE);
> > > > > > manager.makePersistent(area);
>
> > > > > > And this is a part of the Area class:
> > > > > > @PersistenceCapable(identityType=IdentityType.APPLICATION)
> > > > > > public class Area{
> > > > > >         @PrimaryKey
> > > > > >         @Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
> > > > > >         private Key key;
> > > > > >         @Persistent
> > > > > >         private String name;
> > > > > >         @Persistent
> > > > > >         private AreaType areaType;
> > > > > >         @Persistent(mappedBy="key")
> > > > > >         private ArrayList<Area> borderAreas;
> > > > > >         @Persistent(mappedBy="key")
> > > > > >         private ArrayList<Item> items;
> > > > > > //etc
>
> > > > > > I've searched at google for the problem, but got very few results
> > > > > > One of them was about adding some class information to 
> > > > > > jdoconfig.xml,
> > > > > > but at another page I read that this wouldnt be needed, because it's
> > > > > > schemaless
>
> > > > > > I'm using eclipse, got all needed plugins installed (as far as I can
> > > > > > see), and apart from the datastore everything seems to be working
> > > fine
> > > > > > , I don't get any errors in the console when deploying
>
> > > > > > Could anyone tell me what I'm doing wrong?
--~--~---------~--~----~------------~-------~--~----~
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 [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/google-appengine-java?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to