org.postgresql.util.PGobject不能转换为org.postgis.PGgeometry [英] org.postgresql.util.PGobject cannot be cast to org.postgis.PGgeometry
问题描述
当我尝试从PostGIS数据库加载点时,出现以下
异常:
: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)
我想你会遇到和Sebastien Arbogast相同的问题。如果您通过JNDI在容器中使用Hibernate Spatial,那么postgis.jar也应与JDBC驱动程序一起安装,并且 不应包含在WEB-INF中/ lib目录。
当然,这是一个黑暗中的镜头,因为您没有提及任何有关您的环境的信息,提供完整的堆栈跟踪。
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)
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.
这篇关于org.postgresql.util.PGobject不能转换为org.postgis.PGgeometry的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!