Announcement Announcement Module
Collapse
No announcement yet.
Google App Engine Persistence Problems Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Google App Engine Persistence Problems

    I have a small Roo 1.1.1 Spring MVC project that is working fine with

    Code:
    persistence setup --provider HIBERNATE --database HYPERSONIC_PERSISTENT
    However, I intend to eventually deploy on GAE so I tried

    Code:
    persistence setup --provider DATANUCLEUS --database GOOGLE_APP_ENGINE --applicationId caskating
    When I tried to run it on Server I got DataNucleus exceptions on each of my entities:

    Code:
    2011-02-10 20:52:57,612 [main] ERROR DataNucleus.MetaData - Found Meta-Data for class com.getrolling.cis.server.domain.Location but this class is not enhanced!! Please enhance the class before running DataNucleus.
    org.datanucleus.exceptions.NucleusUserException: Found Meta-Data for class com.getrolling.cis.server.domain.Location but this class is not enhanced!! Please enhance the class before running DataNucleus.
    ....
    So I think maybe I should start anew. I delete my project and run my script with GAE persistence. Now I have a new set of problems. My most important entity Tour won't compile. It has 4 many-to-many relationships. In Tour_Roo_JavaBean.aj there are 2 errors for each.

    Code:
        declare @field: * Tour.relatedTours: -@ManyToMany(cascade = CascadeType.ALL);
    has the error

    Code:
    Annotation removal does not allow values to be specified for the annotation (compiler limitation)
    And each of the setters for my many-to-many Sets reference the infamous Employee class. There is no Employee class in my project.

    Despite dire warnings, I fix these in the .aj and try to run. Many more exceptions are thrown.

    It appears that GAE persistence is still not ready for prime time.

  • #2
    Your DataNucleus exceptions were due to the fact that your Datanucleus enhancer didn't run. If you are running eclipse or STS, cleaning the project usually does the trick.

    Regarding you two latest errors, the bugs will be fixed in roo 1.1.2.

    However, I do agree that GAE persistence is still not ready for prime time. GAE relationships management, though implemented, is still a pain.

    Comment


    • #3
      declare @field: * Tour.relatedTours: -@ManyToMany(cascade = CascadeType.ALL);
      This has been fixed in the latest Roo code. Specifying attributes to annotations for removing is not permitted by AspectJ.

      Please try a recent snapshot build or build from source

      Alan

      Comment


      • #4
        I am using STS. I cleaned my projects.

        Now when I run, the DataNucleus exceptions have gone away, but I'm getting an aspectj exception, again on my Tour entity. Any idea what might be wrong?

        Here's the .aj

        Code:
        privileged aspect Tour_Roo_JavaBean {
            
            declare @field: * Tour.region: -@ManyToOne;
            
            declare @field: * Tour.region: @Transient;
            
            declare @field: * Tour.relatedTours: -@ManyToMany;
            
            declare @field: * Tour.relatedTours: @Transient;
            
            declare @field: * Tour.photos: -@ManyToMany;
            
            declare @field: * Tour.photos: @Transient;
            
            declare @field: * Tour.links: -@ManyToMany;
            
            declare @field: * Tour.links: @Transient;
            
            declare @field: * Tour.locations: -@ManyToMany;
            
            declare @field: * Tour.locations: @Transient;
            
            private Long Tour.regionId;
            
            private Set<Key> Tour.relatedToursKeys = new HashSet<Key>();
            
            private Set<Key> Tour.photosKeys = new HashSet<Key>();
            
            private Set<Key> Tour.linksKeys = new HashSet<Key>();
            
            private Set<Key> Tour.locationsKeys = new HashSet<Key>();
            
            public String Tour.getTrail() {
                return this.trail;
            }
            
            public void Tour.setTrail(String trail) {
                this.trail = trail;
            }
            
            public String Tour.getCity() {
                return this.city;
            }
            
            public void Tour.setCity(String city) {
                this.city = city;
            }
            
            public Region Tour.getRegion() {
                if (this.regionId != null) {
                    this.region = Region.findRegion(this.regionId);
                } else {
                    this.region = null;
                }
                return this.region;
            }
            
            public void Tour.setRegion(Region region) {
                if (region != null) {
                    if (region.getId() == null) {
                        region.persist();
                    }
                    this.regionId = region.getId();
                } else {
                    this.regionId = null;
                }
            }
            
            public Float Tour.getDistance() {
                return this.distance;
            }
            
            public void Tour.setDistance(Float distance) {
                this.distance = distance;
            }
            
            public String Tour.getReference() {
                return this.reference;
            }
            
            public void Tour.setReference(String reference) {
                this.reference = reference;
            }
            
            public String Tour.getDirections() {
                return this.directions;
            }
            
            public void Tour.setDirections(String directions) {
                this.directions = directions;
            }
            
            public Ability Tour.getAbility() {
                return this.ability;
            }
            
            public void Tour.setAbility(Ability ability) {
                this.ability = ability;
            }
            
            public Pavement Tour.getPavement() {
                return this.pavement;
            }
            
            public void Tour.setPavement(Pavement pavement) {
                this.pavement = pavement;
            }
            
            public Scenic Tour.getScenic() {
                return this.scenic;
            }
            
            public void Tour.setScenic(Scenic scenic) {
                this.scenic = scenic;
            }
            
            public String Tour.getNotes() {
                return this.notes;
            }
            
            public void Tour.setNotes(String notes) {
                this.notes = notes;
            }
            
            public String Tour.getAuthor() {
                return this.author;
            }
            
            public void Tour.setAuthor(String author) {
                this.author = author;
            }
            
            public String Tour.getAuthorNotes() {
                return this.authorNotes;
            }
            
            public void Tour.setAuthorNotes(String authorNotes) {
                this.authorNotes = authorNotes;
            }
            
            public Date Tour.getLastSkated() {
                return this.lastSkated;
            }
            
            public void Tour.setLastSkated(Date lastSkated) {
                this.lastSkated = lastSkated;
            }
            
            public Date Tour.getAddedOn() {
                return this.addedOn;
            }
            
            public void Tour.setAddedOn(Date addedOn) {
                this.addedOn = addedOn;
            }
            
            public Date Tour.getUpdatedOn() {
                return this.updatedOn;
            }
            
            public void Tour.setUpdatedOn(Date updatedOn) {
                this.updatedOn = updatedOn;
            }
            
            public Set<Tour> Tour.getRelatedTours() {
                Set<com.getrolling.cis.server.domain.Tour> localRelatedTours = new HashSet<com.getrolling.cis.server.domain.Tour>();
                for (Key key : relatedToursKeys) {
                    com.getrolling.cis.server.domain.Tour entity = Tour.findTour(key.getId());
                    if (entity != null) {
                        localRelatedTours.add(entity);
                    }
                }
                this.relatedTours = localRelatedTours;
                return localRelatedTours;
            }
            
            public void Tour.setRelatedTours(Set<Tour> relatedTours) {
                Set<com.getrolling.cis.server.domain.Tour> localRelatedTours = new HashSet<com.getrolling.cis.server.domain.Tour>();
                List<Long> longIds = new ArrayList<Long>();
                for (Key key : relatedToursKeys) {
                    if (!longIds.contains(key.getId())) {
                        longIds.add(key.getId());
                    }
                }
                for (Tour entity : relatedTours) {
                    if (!longIds.contains(entity.getId())) {
                        longIds.add(entity.getId());
                        relatedToursKeys.add(KeyFactory.createKey(Tour.class.getName(), entity.getId()));
                    }
                    localRelatedTours.add(entity);
                }
                this.relatedTours = localRelatedTours;
            }
            
            public Set<Photo> Tour.getPhotos() {
                Set<com.getrolling.cis.server.domain.Photo> localPhotos = new HashSet<com.getrolling.cis.server.domain.Photo>();
                for (Key key : photosKeys) {
                    com.getrolling.cis.server.domain.Photo entity = Photo.findPhoto(key.getId());
                    if (entity != null) {
                        localPhotos.add(entity);
                    }
                }
                this.photos = localPhotos;
                return localPhotos;
            }
            
            public void Tour.setPhotos(Set<Photo> photos) {
                Set<com.getrolling.cis.server.domain.Photo> localPhotos = new HashSet<com.getrolling.cis.server.domain.Photo>();
                List<Long> longIds = new ArrayList<Long>();
                for (Key key : photosKeys) {
                    if (!longIds.contains(key.getId())) {
                        longIds.add(key.getId());
                    }
                }
                for (Photo entity : photos) {
                    if (!longIds.contains(entity.getId())) {
                        longIds.add(entity.getId());
                        photosKeys.add(KeyFactory.createKey(Photo.class.getName(), entity.getId()));
                    }
                    localPhotos.add(entity);
                }
                this.photos = localPhotos;
            }
            
            public Set<Link> Tour.getLinks() {
                Set<com.getrolling.cis.server.domain.Link> localLinks = new HashSet<com.getrolling.cis.server.domain.Link>();
                for (Key key : linksKeys) {
                    com.getrolling.cis.server.domain.Link entity = Link.findLink(key.getId());
                    if (entity != null) {
                        localLinks.add(entity);
                    }
                }
                this.links = localLinks;
                return localLinks;
            }
            
            public void Tour.setLinks(Set<Link> links) {
                Set<com.getrolling.cis.server.domain.Link> localLinks = new HashSet<com.getrolling.cis.server.domain.Link>();
                List<Long> longIds = new ArrayList<Long>();
                for (Key key : linksKeys) {
                    if (!longIds.contains(key.getId())) {
                        longIds.add(key.getId());
                    }
                }
                for (Link entity : links) {
                    if (!longIds.contains(entity.getId())) {
                        longIds.add(entity.getId());
                        linksKeys.add(KeyFactory.createKey(Link.class.getName(), entity.getId()));
                    }
                    localLinks.add(entity);
                }
                this.links = localLinks;
            }
            
            public Set<Location> Tour.getLocations() {
                Set<com.getrolling.cis.server.domain.Location> localLocations = new HashSet<com.getrolling.cis.server.domain.Location>();
                for (Key key : locationsKeys) {
                    com.getrolling.cis.server.domain.Location entity = Location.findLocation(key.getId());
                    if (entity != null) {
                        localLocations.add(entity);
                    }
                }
                this.locations = localLocations;
                return localLocations;
            }
            
            public void Tour.setLocations(Set<Location> locations) {
                Set<com.getrolling.cis.server.domain.Location> localLocations = new HashSet<com.getrolling.cis.server.domain.Location>();
                List<Long> longIds = new ArrayList<Long>();
                for (Key key : locationsKeys) {
                    if (!longIds.contains(key.getId())) {
                        longIds.add(key.getId());
                    }
                }
                for (Location entity : locations) {
                    if (!longIds.contains(entity.getId())) {
                        longIds.add(entity.getId());
                        locationsKeys.add(KeyFactory.createKey(Location.class.getName(), entity.getId()));
                    }
                    localLocations.add(entity);
                }
                this.locations = localLocations;
            }
            
        }
        I'll put the exception in a reply.

        Comment


        • #5
          and here's the exception


          Code:
          Feb 11, 2011 6:13:35 AM org.aspectj.weaver.tools.Jdk14Trace error
          SEVERE: register definition failed
          java.lang.RuntimeException: Problem processing attributes in com.getrolling.cis.server.domain.Tour_Roo_JavaBean
          	at org.aspectj.weaver.bcel.BcelObjectType.ensureAspectJAttributesUnpacked(BcelObjectType.java:383)
          	at org.aspectj.weaver.bcel.BcelObjectType.<init>(BcelObjectType.java:160)
          	at org.aspectj.weaver.bcel.BcelWorld.buildBcelDelegate(BcelWorld.java:394)
          	at org.aspectj.weaver.bcel.BcelWorld.resolveDelegate(BcelWorld.java:389)
          	at org.aspectj.weaver.ltw.LTWWorld.resolveDelegate(LTWWorld.java:111)
          	at org.aspectj.weaver.World.resolveToReferenceType(World.java:461)
          	at org.aspectj.weaver.World.resolve(World.java:305)
          	at org.aspectj.weaver.bcel.BcelWeaver.addLibraryAspect(BcelWeaver.java:159)
          	at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerAspects(ClassLoaderWeavingAdaptor.java:466)
          	at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.registerDefinitions(ClassLoaderWeavingAdaptor.java:290)
          	at org.aspectj.weaver.loadtime.ClassLoaderWeavingAdaptor.initialize(ClassLoaderWeavingAdaptor.java:176)
          	at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.initialize(Aj.java:271)
          	at org.aspectj.weaver.loadtime.Aj$ExplicitlyInitializedClassLoaderWeavingAdaptor.getWeavingAdaptor(Aj.java:276)
          	at org.aspectj.weaver.loadtime.Aj$WeaverContainer.getWeaver(Aj.java:254)
          	at org.aspectj.weaver.loadtime.Aj.preProcess(Aj.java:90)
          	at org.aspectj.weaver.loadtime.ClassPreProcessorAgentAdapter.transform(ClassPreProcessorAgentAdapter.java:54)
          	at com.springsource.insight.collection.tcserver.ltw.TomcatWeavingInsightClassLoader$LoggingClassFileTransformer.transform(TomcatWeavingInsightClassLoader.java:88)
          	at org.springframework.instrument.classloading.WeavingTransformer.transformIfNecessary(WeavingTransformer.java:95)
          	at org.springframework.instrument.classloading.WeavingTransformer.transformIfNecessary(WeavingTransformer.java:78)
          	at org.springframework.instrument.classloading.tomcat.TomcatInstrumentableClassLoader.findResourceInternal(TomcatInstrumentableClassLoader.java:118)
          	at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:2668)
          	at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1124)
          	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1612)
          	at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1491)
          	at org.apache.catalina.startup.WebAnnotationSet.loadClassAnnotation(WebAnnotationSet.java:145)
          	at org.apache.catalina.startup.WebAnnotationSet.loadApplicationListenerAnnotations(WebAnnotationSet.java:73)
          	at org.apache.catalina.startup.WebAnnotationSet.loadApplicationAnnotations(WebAnnotationSet.java:56)
          	at org.apache.catalina.startup.ContextConfig.applicationAnnotationsConfig(ContextConfig.java:297)
          	at org.apache.catalina.startup.ContextConfig.start(ContextConfig.java:1078)
          	at org.apache.catalina.startup.ContextConfig.lifecycleEvent(ContextConfig.java:261)
          	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
          	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4540)
          	at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
          	at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
          	at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:568)
          	at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:637)
          	at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:563)
          	at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:498)
          	at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1282)
          	at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:321)
          	at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:142)
          	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
          	at org.apache.catalina.core.StandardHost.start(StandardHost.java:807)
          	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
          	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:445)
          	at org.apache.catalina.core.StandardService.start(StandardService.java:519)
          	at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
          	at org.apache.catalina.startup.Catalina.start(Catalina.java:581)
          	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 org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
          	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
          Caused by: java.lang.NullPointerException
          	at org.aspectj.weaver.patterns.DeclareAnnotation.read(DeclareAnnotation.java:296)
          	at org.aspectj.weaver.patterns.Declare.read(Declare.java:48)
          	at org.aspectj.weaver.AjAttribute.read(AjAttribute.java:121)
          	at org.aspectj.weaver.bcel.Utility.readAjAttributes(Utility.java:101)
          	at org.aspectj.weaver.bcel.BcelObjectType.ensureAspectJAttributesUnpacked(BcelObjectType.java:379)
          	... 53 more
          Originally posted by martindelemotte View Post
          Your DataNucleus exceptions were due to the fact that your Datanucleus enhancer didn't run. If you are running eclipse or STS, cleaning the project usually does the trick.

          Regarding you two latest errors, the bugs will be fixed in roo 1.1.2.

          However, I do agree that GAE persistence is still not ready for prime time. GAE relationships management, though implemented, is still a pain.

          Comment

          Working...
          X