|
|
|
hila
|
Some javascript/style in this post has been disabled (why?)
Hi, I am using oracle hibernate spatial with spring framework. I get "com.vividsolutions.jts.geom.Polygon does not have a no-arg default constructor" error when I deploy it to Tomcat. I believe the no-args constructor error came because the Polygon class does not have a constructor with no arguments, is this correct? If so, is there a workaround? I've tried many sites to see if there is a solution, without any success. Any idea how to solve this issue? Appreciate any kind of help. Here are some of my classes. entity class that include a geometry column @Entity @Table(name = "SPATIALTABLE") public class Test implements Serializable, Comparable<Test> { ... @Column(name="Loc", columnDefinition="MDSYS.SDO_GEOMETRY", nullable = true) @Type(type="org.hibernatespatial.GeometryUserType") private Polygon location = null; public Polygon getLocation() { return location; } public void setLocation(Polygon location) { this.location = location; } // empty constructor public Test(){} ... } ====== The class where I get the error ================ public class TestTarget implements Serializable, Comparable<TestTarget > { ... ... @OneToMany( cascade = CascadeType.ALL) @org.hibernate.annotations.Cascade({ org.hibernate.annotations.CascadeType.DELETE_ORPHAN }) @JoinColumn(name = "ID", nullable = false) // unidirectional from tableA(one) to TableB (many) @org.hibernate.annotations.Sort( type = org.hibernate.annotations.SortType.COMPARATOR, comparator = com.xx.xx.xx.xx.comparator.SpatialComparator.class ) private SortedSet<Test> spatialP = new TreeSet<Test>(); error trace Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions com.vividsolutions.jts.geom.Polygon does not have a no-arg default constructor. this problem is related to the following location: at com.vividsolutions.jts.geom.Polygon at public com.vividsolutions.jts.geom.Polygon com.xx.xx.pojo.spatial.model.Test.getLocation() at com.xx.xx.pojo.spatial.model.Test private java.util.SortedSet com.xx.xx.pojo.TestTarget.spatialP ... ... Hotmail: Trusted email with powerful SPAM protection. Sign up now. _______________________________________________ hibernatespatial-users mailing list [hidden email] http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users |
||||||||||||||||
|
Karel Maesen
|
Hi,
I see that the exception thrown in a JAXB exception. What is JAXB doing here? Are you serializing using JAXB? In that case you can't use the Polygon class because it has no no-arg constructor (a requirement of JAXB serialization). If disabling JAXB serialization is no option, you could subclass Polygon and create a no-arg constructor for this subclassed Polygon. HS will persist them just like "regular" polygons. Regards, Karel Maesen On 21 Oct 2009, at 18:20, milan Olumee wrote: > > Hi, > > I am using oracle hibernate spatial with spring framework. I get > "com.vividsolutions.jts.geom.Polygon does not have a no-arg default > constructor" error when I deploy it to Tomcat. > > I believe the no-args constructor error came because the Polygon > class does not have a constructor with no arguments, is this > correct? If so, is there a workaround? > > I've tried many sites to see if there is a solution, without any > success. Any idea how to solve this issue? > Appreciate any kind of help. > > Here are some of my classes. > > entity class that include a geometry column > > @Entity > @Table(name = "SPATIALTABLE") > > public class Test implements Serializable, Comparable<Test> { > ... > > @Column(name="Loc", columnDefinition="MDSYS.SDO_GEOMETRY", > nullable = true) > @Type(type="org.hibernatespatial.GeometryUserType") > > private Polygon location = null; > > public Polygon getLocation() { > return location; > } > public void setLocation(Polygon location) { > this.location = location; > } > > // empty constructor > public Test(){} > ... > } > > ====== The class where I get the error ================ > public class TestTarget implements Serializable, > Comparable<TestTarget > { > ... > ... > > @OneToMany( > cascade = CascadeType.ALL) > @org.hibernate.annotations.Cascade({ > org.hibernate.annotations.CascadeType.DELETE_ORPHAN > }) > @JoinColumn(name = "ID", nullable = false) > // unidirectional from tableA(one) to TableB (many) > @org.hibernate.annotations.Sort( > type = org.hibernate.annotations.SortType.COMPARATOR, > comparator = > com.xx.xx.xx.xx.comparator.SpatialComparator.class > ) > private SortedSet<Test> spatialP = new TreeSet<Test>(); > > error trace > > Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: > 1 counts of IllegalAnnotationExceptions > com.vividsolutions.jts.geom.Polygon does not have a no-arg default > constructor. > this problem is related to the following location: > at com.vividsolutions.jts.geom.Polygon > at public com.vividsolutions.jts.geom.Polygon > com.xx.xx.pojo.spatial.model.Test.getLocation() > at com.xx.xx.pojo.spatial.model.Test > private java.util.SortedSet com.xx.xx.pojo.TestTarget.spatialP > ... > ... > > > Hotmail: Trusted email with powerful SPAM protection. Sign up now. > _______________________________________________ > hibernatespatial-users mailing list > [hidden email] > http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ > hibernatespatial-users _______________________________________________ hibernatespatial-users mailing list [hidden email] http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users |
|
hila
|
Some javascript/style in this post has been disabled (why?)
Hi Karel,Thank you. Unfortunately, I cannot disable JAXB serialization, therefore, I've created a new Polygon class as you suggested and use the new Polygon class in my entity class. I still get the same error. Here is the new polygon class that I created, could you verify if this is correct? If correct, is there any other suggestion you might have to solve this issue? public class SpatialPolygon extends Polygon implements Serializable { public SpatialPolygon() { super(null, null, new GeometryFactory()); } } Best Regards H. > From: [hidden email] > Date: Wed, 21 Oct 2009 19:03:24 +0200 > To: [hidden email] > Subject: Re: [hibernatespatial-users] (no subject) > > Hi, > > I see that the exception thrown in a JAXB exception. What is JAXB > doing here? Are you serializing using JAXB? In that case you can't > use the Polygon class because it has no no-arg constructor (a > requirement of JAXB serialization). > > If disabling JAXB serialization is no option, you could subclass > Polygon and create a no-arg constructor for this subclassed Polygon. > HS will persist them just like "regular" polygons. > > Regards, > > Karel Maesen > > > On 21 Oct 2009, at 18:20, milan Olumee wrote: > > > > > Hi, > > > > I am using oracle hibernate spatial with spring framework. I get > > "com.vividsolutions.jts.geom.Polygon does not have a no-arg default > > constructor" error when I deploy it to Tomcat. > > > > I believe the no-args constructor error came because the Polygon > > class does not have a constructor with no arguments, is this > > correct? If so, is there a workaround? > > > > I've tried many sites to see if there is a solution, without any > > success. Any idea how to solve this issue? > > Appreciate any kind of help. > > > > Here are some of my classes. > > > > entity class that include a geometry column > > > > @Entity > > @Table(name = "SPATIALTABLE") > > > > public class Test implements Serializable, Comparable<Test> { > > ... > > > > @Column(name="Loc", columnDefinition="MDSYS.SDO_GEOMETRY", > > nullable = true) > > @Type(type="org.hibernatespatial.GeometryUserType") > > > > private Polygon location = null; > > > > public Polygon getLocation() { > > return location; > > } > > public void setLocation(Polygon location) { > > this.location = location; > > } > > > > // empty constructor > > public Test(){} > > ... > > } > > > > ====== The class where I get the error ================ > > public class TestTarget implements Serializable, > > Comparable<TestTarget > { > > ... > > ... > > > > @OneToMany( > > cascade = CascadeType.ALL) > > @org.hibernate.annotations.Cascade({ > > org.hibernate.annotations.CascadeType.DELETE_ORPHAN > > }) > > @JoinColumn(name = "ID", nullable = false) > > // unidirectional from tableA(one) to TableB (many) > > @org.hibernate.annotations.Sort( > > type = org.hibernate.annotations.SortType.COMPARATOR, > > comparator = > > com.xx.xx.xx.xx.comparator.SpatialComparator.class > > ) > > private SortedSet<Test> spatialP = new TreeSet<Test>(); > > > > error trace > > > > Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: > > 1 counts of IllegalAnnotationExceptions > > com.vividsolutions.jts.geom.Polygon does not have a no-arg default > > constructor. > > this problem is related to the following location: > > at com.vividsolutions.jts.geom.Polygon > > at public com.vividsolutions.jts.geom.Polygon > > com.xx.xx.pojo.spatial.model.Test.getLocation() > > at com.xx.xx.pojo.spatial.model.Test > > private java.util.SortedSet com.xx.xx.pojo.TestTarget.spatialP > > ... > > ... > > > > > > Hotmail: Trusted email with powerful SPAM protection. Sign up now. > > _______________________________________________ > > hibernatespatial-users mailing list > > [hidden email] > > http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ > > hibernatespatial-users > > _______________________________________________ > hibernatespatial-users mailing list > [hidden email] > http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users Hotmail: Free, trusted and rich email service. Get it now. _______________________________________________ hibernatespatial-users mailing list [hidden email] http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users |
||||||||||||||||
|
Karel Maesen
|
It looks correct to me. If this still doesn't work I guess you have a
problem in your configuration somewhere. In any case, it looks like a Spring/JAXB problem rather than a Hibernate Spatial problem. Regards, Karel On 21 Oct 2009, at 20:27, milan Olumee wrote: > Hi Karel, > > Thank you. Unfortunately, I cannot disable JAXB serialization, > therefore, I've created a new Polygon class as you suggested and > use the new Polygon class in my entity class. I still get the same > error. Here is the new polygon class that I created, could you > verify if this is correct? If correct, is there any other > suggestion you might have to solve this issue? > > > public class SpatialPolygon extends Polygon implements Serializable { > > public SpatialPolygon() { > super(null, null, new GeometryFactory()); > } > } > > Best Regards > > H. > > > From: [hidden email] > > Date: Wed, 21 Oct 2009 19:03:24 +0200 > > To: [hidden email] > > Subject: Re: [hibernatespatial-users] (no subject) > > > > Hi, > > > > I see that the exception thrown in a JAXB exception. What is JAXB > > doing here? Are you serializing using JAXB? In that case you can't > > use the Polygon class because it has no no-arg constructor (a > > requirement of JAXB serialization). > > > > If disabling JAXB serialization is no option, you could subclass > > Polygon and create a no-arg constructor for this subclassed Polygon. > > HS will persist them just like "regular" polygons. > > > > Regards, > > > > Karel Maesen > > > > > > On 21 Oct 2009, at 18:20, milan Olumee wrote: > > > > > > > > Hi, > > > > > > I am using oracle hibernate spatial with spring framework. I get > > > "com.vividsolutions.jts.geom.Polygon does not have a no-arg > default > > > constructor" error when I deploy it to Tomcat. > > > > > > I believe the no-args constructor error came because the Polygon > > > class does not have a constructor with no arguments, is this > > > correct? If so, is there a workaround? > > > > > > I've tried many sites to see if there is a solution, without any > > > success. Any idea how to solve this issue? > > > Appreciate any kind of help. > > > > > > Here are some of my classes. > > > > > > entity class that include a geometry column > > > > > > @Entity > > > @Table(name = "SPATIALTABLE") > > > > > > public class Test implements Serializable, Comparable<Test> { > > > ... > > > > > > @Column(name="Loc", columnDefinition="MDSYS.SDO_GEOMETRY", > > > nullable = true) > > > @Type(type="org.hibernatespatial.GeometryUserType") > > > > > > private Polygon location = null; > > > > > > public Polygon getLocation() { > > > return location; > > > } > > > public void setLocation(Polygon location) { > > > this.location = location; > > > } > > > > > > // empty constructor > > > public Test(){} > > > ... > > > } > > > > > > ====== The class where I get the error ================ > > > public class TestTarget implements Serializable, > > > Comparable<TestTarget > { > > > ... > > > ... > > > > > > @OneToMany( > > > cascade = CascadeType.ALL) > > > @org.hibernate.annotations.Cascade({ > > > org.hibernate.annotations.CascadeType.DELETE_ORPHAN > > > }) > > > @JoinColumn(name = "ID", nullable = false) > > > // unidirectional from tableA(one) to TableB (many) > > > @org.hibernate.annotations.Sort( > > > type = org.hibernate.annotations.SortType.COMPARATOR, > > > comparator = > > > com.xx.xx.xx.xx.comparator.SpatialComparator.class > > > ) > > > private SortedSet<Test> spatialP = new TreeSet<Test>(); > > > > > > error trace > > > > > > Caused by: > com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: > > > 1 counts of IllegalAnnotationExceptions > > > com.vividsolutions.jts.geom.Polygon does not have a no-arg default > > > constructor. > > > this problem is related to the following location: > > > at com.vividsolutions.jts.geom.Polygon > > > at public com.vividsolutions.jts.geom.Polygon > > > com.xx.xx.pojo.spatial.model.Test.getLocation() > > > at com.xx.xx.pojo.spatial.model.Test > > > private java.util.SortedSet com.xx.xx.pojo.TestTarget.spatialP > > > ... > > > ... > > > > > > > > > Hotmail: Trusted email with powerful SPAM protection. Sign up now. > > > _______________________________________________ > > > hibernatespatial-users mailing list > > > [hidden email] > > > http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ > > > hibernatespatial-users > > > > _______________________________________________ > > hibernatespatial-users mailing list > > [hidden email] > > http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ > hibernatespatial-users > > Hotmail: Free, trusted and rich email service. Get it now. > _______________________________________________ > hibernatespatial-users mailing list > [hidden email] > http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ > hibernatespatial-users _______________________________________________ hibernatespatial-users mailing list [hidden email] http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users |
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |