我正在从 Glassfish4 迁移到 WildFly8 应用程序服务器并收到以下错误:
Can't convert object of type org.postgresql.util.PGobject
我正在使用 Hibernate Spatial 和 PostGIS。对于 Glassfish 服务器,我将 postgis jar 添加到/lib/ext 文件夹以修复该错误。
我遵循了本教程中的步骤:https://gist.github.com/bjornharrtell/3054462 ,但它对我不起作用,即我将这些模块添加到/org/hibernate/main :
hibernate-spatial-4.3.jar
resource-root path="jts-1.13.jar
以及 modules.xml 中的这些条目:
<resource-root path="hibernate-spatial-4.3.jar"/>
<resource-root path="jts-1.13.jar"/>
...
<module name="org.postgresql"/>
和/org/postgresql/main:
postgresql-9.3-1101.jdbc41.jar
postgis-jdbc-1.5.3.jar
完整的 modules.xml:
<?xml version="1.0" encoding="UTF-8"?>
<module xmlns="urn:jboss:module:1.1" name="org.postgresql">
<resources>
<resource-root path="postgresql-9.3-1101.jdbc41.jar"/>
<resource-root path="postgis-jdbc-1.5.3.jar"/>
</resources>
<dependencies>
<module name="javax.api"/>
<module name="javax.transaction.api"/>
</dependencies>
</module>
我还尝试将 jars 添加到 WEB-INF/lib,但是当我将“Dependencies: org.postgresql export”添加到 MANIFEST.MF 时,我得到:
org.jboss.modules.ModuleNotFoundException: org.postgresql:main
关于如何正确加载 postgis、hibernate-spatial 等类的任何想法?
干杯, 多米尼克
最佳答案
解决了!在以下位置找到了与我的服务器类似的设置:https://github.com/opennucleus/opennucleus我看着差异。结果在 standalone.xml 中我应该放:
<driver name="postgresql-driver" module="org.postgresql">
<driver-class>org.postgresql.Driver</driver-class>
</driver>
代替:
<driver name="postgresql" module="org.postgresql">
<xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>
现在一切正常!
关于使用 WildFly 8 hibernate 空间和 PostGIS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24565301/