org.postgresql.util.PGobject不能转换为org.postgis.PGgeometry [英] org.postgresql.util.PGobject cannot be cast to org.postgis.PGgeometry

查看:3108
本文介绍了org.postgresql.util.PGobject不能转换为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)


>解决方案< PGgeometry-td1141096.htmlrel =nofollow noreferrer> PGobject不能转换为PGgeometry ,所以我会引用相关的答案:


我想你会遇到和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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆