views:

38

answers:

1

When I try to load points from a PostGIS database, I get the following exception:

Caused by: java.lang.ClassCastException: org.postgresql.util.PGobject
        at org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:75)
        at org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryType.java:123)
        at org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:169) 
+1  A: 

It looks like the problem described in PGobject cannot be cast to PGgeometry so I'll quote the relevant answer:

I guess you run into the same problem as Sebastien Arbogast a while back. If you use Hibernate Spatial in a web container with the JDBC provided by the container through JNDI, then the postgis.jar should also be installed together with the JDBC driver and should not be contained in the WEB-INF/lib directory.

Of course, this is a shot in the dark since you didn't mention anything about your environment and didn't provide the full stack trace.

Pascal Thivent