3

I'm migrating from Glassfish4 to WildFly8 application server and get the following error:

Can't convert object of type org.postgresql.util.PGobject

I am using Hibernate Spatial and PostGIS. For the Glassfish server I added the postgis jar to the /lib/ext folder to fix that error.

I followed the steps in this tutorial: https://gist.github.com/bjornharrtell/3054462, but it doesn't work for me, i.e. I added these modules to /org/hibernate/main :

hibernate-spatial-4.3.jar
resource-root path="jts-1.13.jar

and these entries to modules.xml:

<resource-root path="hibernate-spatial-4.3.jar"/>
<resource-root path="jts-1.13.jar"/>
...
<module name="org.postgresql"/>

and to /org/postgresql/main:

postgresql-9.3-1101.jdbc41.jar
postgis-jdbc-1.5.3.jar

full 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>

I also tried just adding the jars to WEB-INF/lib, but when I add 'Dependencies: org.postgresql export' to MANIFEST.MF, I get:

org.jboss.modules.ModuleNotFoundException: org.postgresql:main

Any ideas how I can get the postgis, hibernate-spatial, etc. classes all loaded correctly?

Cheers, Dominik

user473453
  • 894
  • 2
  • 11
  • 23

1 Answers1

1

Solved it! Found a similar setup to my server at: https://github.com/opennucleus/opennucleus and I looked at the differences. Turns out in standalone.xml I should have put:

<driver name="postgresql-driver" module="org.postgresql">
                    <driver-class>org.postgresql.Driver</driver-class>
                </driver>

instead of:

<driver name="postgresql" module="org.postgresql">
   <xa-datasource-class>org.postgresql.xa.PGXADataSource</xa-datasource-class>
</driver>

Now it all works fine!

user473453
  • 894
  • 2
  • 11
  • 23