File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Groovy and the fly likes grails and spatial data (custom type) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Languages » Groovy
Bookmark "grails and spatial data (custom type)" Watch "grails and spatial data (custom type)" New topic
Author

grails and spatial data (custom type)

J. Cartwright
Greenhorn

Joined: Sep 27, 2004
Posts: 16
Hello All,

I'm trying to create a grails 1.1.1 application using spatial data along the lines of the blog entry at http://blog.mollusca.ch/2008/10/4/grails-spatial-data-postgis

The problem I'm having is that when I call the create method, I get the following exception:

Error 500: Error processing GroovyPageView: Error executing tag <g:form>: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [com.vividsolutions.jts.geom.Point.list()] on line [52]: groovy.lang.MissingMethodException: No signature of method: static com.vividsolutions.jts.geom.Point.list() is applicable for argument types: () values: []
Servlet: grails
URI: /spatial-demo/grails/event/create.dispatch
Exception Message: No signature of method: static com.vividsolutions.jts.geom.Point.list() is applicable for argument types: () values: []
Caused by: Error processing GroovyPageView: Error executing tag <g:form>: org.codehaus.groovy.grails.web.pages.exceptions.GroovyPagesException: Error evaluating expression [com.vividsolutions.jts.geom.Point.list()] on line [52]: groovy.lang.MissingMethodException: No signature of method: static com.vividsolutions.jts.geom.Point.list() is applicable for argument types: () values: []
Class: /event/create


Can someone please help understand what the problem might be?

Thanks!

--john
Peter Ledbrook
author
Greenhorn

Joined: Jul 15, 2009
Posts: 25
Hi John,

I don't believe that Point is a domain class - it's a Hibernate custom type. That means Grails will not add the domain class methods like list() to it. As Silvio says, the scaffolding code probably thinks that Point is a domain class, so it includes a call to list().

If you haven't already done so, use either the grails generate-views or grails generate-all commands to create the physical GSP files. You can then modify them to remove the offending call to Point.list().

Hope that helps,

Peter
J. Cartwright
Greenhorn

Joined: Sep 27, 2004
Posts: 16
Thank you very much for your reply Peter. Removing those calls, e.g.

<g:select optionKey="id" from="${com.vividsolutions.jts.geom.Point.list()}" name="location.id" value="${eventInstance?.location?.id}" ></g:select>

does allow the page to display. I'm still confused however as to why Grails sees the "Point" class as a domain class rather than a property class like the String. Can you elaborate on the role of the PropertyEditorSupport class (com.vividsolutions.jts.geom.PointEditor, in my case) then?

Thanks again for your help!

--john


Peter Ledbrook
author
Greenhorn

Joined: Jul 15, 2009
Posts: 25
It's a bug in the scaffolding code. I suspect that it simply wasn't changed when custom types were introduced to Grails, so it uses some old (broken) way to determine whether a field is a relationship or not.

I don't think PropertyEditorSupport classes have any impact on the scaffolding. As far as I'm aware, they're only used during data-binding, for example when the params object is bound to a domain or command object.

Cheers,

Peter
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: grails and spatial data (custom type)