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

16 messages Options
Embed this post
Permalink
Greg Ederer

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

Reply Threaded More More options
Print post
Permalink
Hi,

I'm working off of the tutorial at http://www.hibernatespatial.org/tutorial.html.  I have been able to load a point into the database via:

  ant run -Daction=store -Dgeom="POINT(10 15)"

But, when I run:

  ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1 1))"

after modifying the main method and adding the find method, I get this output:

     [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
     [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_, this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within(this_.LOC, ?))
     [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_, this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within(this_.LOC, ?))
     [java] Exception in thread "main" java.lang.IllegalArgumentException: Can't convert object of type org.postgresql.util.PGobject
     [java]     at org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:120)
     [java]     at org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryType.java:127)
     [java]     at org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:170)
     [java]     at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
     [java]     at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
     [java]     at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
     [java]     at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
     [java]     at org.hibernate.loader.Loader.getRow(Loader.java:1206)
     [java]     at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
     [java]     at org.hibernate.loader.Loader.doQuery(Loader.java:701)
     [java]     at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
     [java]     at org.hibernate.loader.Loader.doList(Loader.java:2220)
     [java]     at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
     [java]     at org.hibernate.loader.Loader.list(Loader.java:2099)
     [java]     at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
     [java]     at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
     [java]     at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
     [java]     at org.earthserve.model.EventManager.find(Unknown Source)
     [java]     at org.earthserve.model.EventManager.main(Unknown Source)
     [java] Java Result: 1

I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from kyngchaos. Any suggestions?

Thanks!

Greg
Karel Maesen

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

Reply Threaded More More options
Print post
Permalink
Hi,

Can you post the return of the following sql (executed from the psql  
command-line utility) : select title, astext(loc) from events;

Karel Maesen


On 06 Feb 2008, at 19:54, gederer wrote:

>
> Hi,
>
> I'm working off of the tutorial at
> http://www.hibernatespatial.org/tutorial.html.  I have been able to  
> load a
> point into the database via:
>
>   ant run -Daction=store -Dgeom="POINT(10 15)"
>
> But, when I run:
>
>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1 1))"
>
> after modifying the main method and adding the find method, I get this
> output:
>
>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as  
> title0_0_,
> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
> within(this_.LOC, ?))
>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,  
> this_.LOC as
> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
> (this_.LOC, ?))
>      [java] Exception in thread "main"  
> java.lang.IllegalArgumentException:
> Can't convert object of type org.postgresql.util.PGobject
>      [java]     at
> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
> (PGGeometryUserType.java:120)
>      [java]     at
> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
> (AbstractDBGeometryType.java:127)
>      [java]     at
> org.hibernatespatial.GeometryUserType.nullSafeGet
> (GeometryUserType.java:170)
>      [java]     at
> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>      [java]     at
> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>      [java]     at
> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
> (AbstractEntityPersister.java:2096)
>      [java]     at
> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>      [java]     at
> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
>      [java]     at org.hibernate.loader.Loader.getRow(Loader.java:
> 1206)
>      [java]     at
> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>      [java]     at org.hibernate.loader.Loader.doQuery(Loader.java:
> 701)
>      [java]     at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
> (Loader.java:236)
>      [java]     at org.hibernate.loader.Loader.doList(Loader.java:
> 2220)
>      [java]     at
> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
>      [java]     at org.hibernate.loader.Loader.list(Loader.java:2099)
>      [java]     at
> org.hibernate.loader.criteria.CriteriaLoader.list
> (CriteriaLoader.java:94)
>      [java]     at
> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>      [java]     at
> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>      [java]     at org.earthserve.model.EventManager.find(Unknown  
> Source)
>      [java]     at org.earthserve.model.EventManager.main(Unknown  
> Source)
>      [java] Java Result: 1
>
> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from kyngchaos. Any
> suggestions?
>
> Thanks!
>
> Greg
> --
> View this message in context: http://www.nabble.com/Can%27t-convert- 
> object-of-type-org.postgresql.util.PGobject-tp15310652p15310652.html
> Sent from the Hibernate Spatial - Users mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Greg Ederer

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Greg Ederer
Hi Karel,

Thanks for your reply. Here is the result of the query you sugested:

testdb=# select title, astext(loc) from events;
  title   |    astext    
----------+--------------
 My Event | POINT(10 15)
(1 row)

Also, I saw another post on this list where the 'Can't convert object of type org.postgresql.util.PGobject' occurred, and the problem was solved by placing postgis.jar on the classpath. I checked to be certain, and I do have this jar in my lib directory, and ant is able to find it.

Thanks!

Greg

gederer wrote:
Hi,

I'm working off of the tutorial at http://www.hibernatespatial.org/tutorial.html.  I have been able to load a point into the database via:

  ant run -Daction=store -Dgeom="POINT(10 15)"

But, when I run:

  ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1 1))"

after modifying the main method and adding the find method, I get this output:

     [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
     [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_, this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within(this_.LOC, ?))
     [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_, this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within(this_.LOC, ?))
     [java] Exception in thread "main" java.lang.IllegalArgumentException: Can't convert object of type org.postgresql.util.PGobject
     [java]     at org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:120)
     [java]     at org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryType.java:127)
     [java]     at org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:170)
     [java]     at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
     [java]     at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
     [java]     at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
     [java]     at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
     [java]     at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
     [java]     at org.hibernate.loader.Loader.getRow(Loader.java:1206)
     [java]     at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
     [java]     at org.hibernate.loader.Loader.doQuery(Loader.java:701)
     [java]     at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
     [java]     at org.hibernate.loader.Loader.doList(Loader.java:2220)
     [java]     at org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
     [java]     at org.hibernate.loader.Loader.list(Loader.java:2099)
     [java]     at org.hibernate.loader.criteria.CriteriaLoader.list(CriteriaLoader.java:94)
     [java]     at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
     [java]     at org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
     [java]     at org.earthserve.model.EventManager.find(Unknown Source)
     [java]     at org.earthserve.model.EventManager.main(Unknown Source)
     [java] Java Result: 1

I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from kyngchaos. Any suggestions?

Thanks!

Greg
Karel Maesen

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

Reply Threaded More More options
Print post
Permalink
Hi Greg,

The postgresql + postgis do not return PGgeometry (or Geometry)  
objects but "plain" PGobjects. Since postgis.jar is correctly  
installed, it seems that the postgresql jdbc driver fails to register  
the postgis supplied geometry types. Could you check whether you have  
a 8.0 or higher version of the postgresql JDBC driver?

You might also try to change in the jdbc URL  "jdbc:postgresql"  
into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file). This  
uses the postgis DriverWrapper which registers the geometry types  
explicitly.

Regards,

Karel


On 06 Feb 2008, at 20:16, gederer wrote:

>
> Hi Karel,
>
> Thanks for your reply. Here is the result of the query you sugested:
>
> testdb=# select title, astext(loc) from events;
>   title   |    astext
> ----------+--------------
>  My Event | POINT(10 15)
> (1 row)
>
> Also, I saw another post on this list where the 'Can't convert  
> object of
> type org.postgresql.util.PGobject' occurred, and the problem was  
> solved by
> placing postgis.jar on the classpath. I checked to be certain, and  
> I do have
> this jar in my lib directory, and ant is able to find it.
>
> Thanks!
>
> Greg
>
>
> gederer wrote:
>>
>> Hi,
>>
>> I'm working off of the tutorial at
>> http://www.hibernatespatial.org/tutorial.html.  I have been able  
>> to load a
>> point into the database via:
>>
>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>
>> But, when I run:
>>
>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1 1))"
>>
>> after modifying the main method and adding the find method, I get  
>> this
>> output:
>>
>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as  
>> title0_0_,
>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>> within(this_.LOC, ?))
>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,  
>> this_.LOC as
>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>> (this_.LOC,
>> ?))
>>      [java] Exception in thread "main"  
>> java.lang.IllegalArgumentException:
>> Can't convert object of type org.postgresql.util.PGobject
>>      [java]     at
>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>> (PGGeometryUserType.java:120)
>>      [java]     at
>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>> (AbstractDBGeometryType.java:127)
>>      [java]     at
>> org.hibernatespatial.GeometryUserType.nullSafeGet
>> (GeometryUserType.java:170)
>>      [java]     at
>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>      [java]     at
>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>      [java]     at
>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>> (AbstractEntityPersister.java:2096)
>>      [java]     at
>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>      [java]     at
>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
>>      [java]     at org.hibernate.loader.Loader.getRow(Loader.java:
>> 1206)
>>      [java]     at
>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>      [java]     at org.hibernate.loader.Loader.doQuery(Loader.java:
>> 701)
>>      [java]     at
>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
>> (Loader.java:236)
>>      [java]     at org.hibernate.loader.Loader.doList(Loader.java:
>> 2220)
>>      [java]     at
>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:2099)
>>      [java]     at
>> org.hibernate.loader.criteria.CriteriaLoader.list
>> (CriteriaLoader.java:94)
>>      [java]     at
>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>      [java]     at
>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>      [java]     at org.earthserve.model.EventManager.find(Unknown  
>> Source)
>>      [java]     at org.earthserve.model.EventManager.main(Unknown  
>> Source)
>>      [java] Java Result: 1
>>
>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from kyngchaos. Any
>> suggestions?
>>
>> Thanks!
>>
>> Greg
>>
>
> --
> View this message in context: http://www.nabble.com/Can%27t-convert- 
> object-of-type-org.postgresql.util.PGobject-tp15310652p15311498.html
> Sent from the Hibernate Spatial - Users mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Greg Ederer

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

Reply Threaded More More options
Print post
Permalink
Hi Karel,

I see that ant reports:

     [java] 11:08:22,256  INFO SettingsFactory:89 - RDBMS: PostgreSQL,
version: 8.2.5
     [java] 11:08:22,257  INFO SettingsFactory:90 - JDBC driver:
PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL (build 407)

which is odd because I'm using postgresql-8.2-508.jdbc3.jar.

When I switched to jdbc:postgresql_postGIS://localhost:5432/testdb, I got:

     [java] 11:38:32,244  WARN JDBCExceptionReporter:77 - SQL Error: 0,
SQLState: 08001
     [java] 11:38:32,245 ERROR JDBCExceptionReporter:78 - No suitable driver
     [java] Exception in thread "main"
org.hibernate.exception.JDBCConnectionException: Cannot open connection
     [java]     at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:74)
     [java]     at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
     [java]     at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
     [java]     at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
     [java]     at
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
     [java]     at
org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
     [java]     at
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
     [java]     at
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
     [java]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
     [java]     at $Proxy0.beginTransaction(Unknown Source)
     [java]     at org.earthserve.model.EventManager.find(Unknown Source)
     [java]     at org.earthserve.model.EventManager.main(Unknown Source)
     [java] Caused by: java.sql.SQLException: No suitable driver
     [java]     at
java.sql.DriverManager.getConnection(DriverManager.java:545)
     [java]     at
java.sql.DriverManager.getConnection(DriverManager.java:140)
     [java]     at
org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
     [java]     at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
     [java]     ... 12 more
     [java] Java Result: 1

Cheers,

Greg

Karel Maesen wrote:

> Hi Greg,
>
> The postgresql + postgis do not return PGgeometry (or Geometry)  
> objects but "plain" PGobjects. Since postgis.jar is correctly  
> installed, it seems that the postgresql jdbc driver fails to register  
> the postgis supplied geometry types. Could you check whether you have  
> a 8.0 or higher version of the postgresql JDBC driver?
>
> You might also try to change in the jdbc URL  "jdbc:postgresql"  
> into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file). This  
> uses the postgis DriverWrapper which registers the geometry types  
> explicitly.
>
> Regards,
>
> Karel
>
>
> On 06 Feb 2008, at 20:16, gederer wrote:
>
>  
>> Hi Karel,
>>
>> Thanks for your reply. Here is the result of the query you sugested:
>>
>> testdb=# select title, astext(loc) from events;
>>   title   |    astext
>> ----------+--------------
>>  My Event | POINT(10 15)
>> (1 row)
>>
>> Also, I saw another post on this list where the 'Can't convert  
>> object of
>> type org.postgresql.util.PGobject' occurred, and the problem was  
>> solved by
>> placing postgis.jar on the classpath. I checked to be certain, and  
>> I do have
>> this jar in my lib directory, and ant is able to find it.
>>
>> Thanks!
>>
>> Greg
>>
>>
>> gederer wrote:
>>    
>>> Hi,
>>>
>>> I'm working off of the tutorial at
>>> http://www.hibernatespatial.org/tutorial.html.  I have been able  
>>> to load a
>>> point into the database via:
>>>
>>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>>
>>> But, when I run:
>>>
>>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1 1))"
>>>
>>> after modifying the main method and adding the find method, I get  
>>> this
>>> output:
>>>
>>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as  
>>> title0_0_,
>>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>>> within(this_.LOC, ?))
>>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,  
>>> this_.LOC as
>>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>>> (this_.LOC,
>>> ?))
>>>      [java] Exception in thread "main"  
>>> java.lang.IllegalArgumentException:
>>> Can't convert object of type org.postgresql.util.PGobject
>>>      [java]     at
>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>>> (PGGeometryUserType.java:120)
>>>      [java]     at
>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>> (AbstractDBGeometryType.java:127)
>>>      [java]     at
>>> org.hibernatespatial.GeometryUserType.nullSafeGet
>>> (GeometryUserType.java:170)
>>>      [java]     at
>>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>>      [java]     at
>>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>>      [java]     at
>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>> (AbstractEntityPersister.java:2096)
>>>      [java]     at
>>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>>      [java]     at
>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
>>>      [java]     at org.hibernate.loader.Loader.getRow(Loader.java:
>>> 1206)
>>>      [java]     at
>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>>      [java]     at org.hibernate.loader.Loader.doQuery(Loader.java:
>>> 701)
>>>      [java]     at
>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
>>> (Loader.java:236)
>>>      [java]     at org.hibernate.loader.Loader.doList(Loader.java:
>>> 2220)
>>>      [java]     at
>>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
>>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:2099)
>>>      [java]     at
>>> org.hibernate.loader.criteria.CriteriaLoader.list
>>> (CriteriaLoader.java:94)
>>>      [java]     at
>>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>>      [java]     at
>>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>>      [java]     at org.earthserve.model.EventManager.find(Unknown  
>>> Source)
>>>      [java]     at org.earthserve.model.EventManager.main(Unknown  
>>> Source)
>>>      [java] Java Result: 1
>>>
>>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from kyngchaos. Any
>>> suggestions?
>>>
>>> Thanks!
>>>
>>> Greg
>>>
>>>      
>> --
>> View this message in context: http://www.nabble.com/Can%27t-convert- 
>> object-of-type-org.postgresql.util.PGobject-tp15310652p15311498.html
>> Sent from the Hibernate Spatial - Users mailing list archive at  
>> Nabble.com.
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>    
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>  


--
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| [hidden email]
| 360.774.6848
|

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Karel Maesen

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

Reply Threaded More More options
Print post
Permalink

I just checked. Using "jdbc:postgresql_POSTGIS" doesn't work on my  
system either.

Is it possible that you have somewhere else a postgresql driver on  
the classpath (try running ant with the -verbose option)?


On 06 Feb 2008, at 20:43, Greg Ederer wrote:

> Hi Karel,
>
> I see that ant reports:
>
>      [java] 11:08:22,256  INFO SettingsFactory:89 - RDBMS: PostgreSQL,
> version: 8.2.5
>      [java] 11:08:22,257  INFO SettingsFactory:90 - JDBC driver:
> PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL  
> (build 407)
>
> which is odd because I'm using postgresql-8.2-508.jdbc3.jar.
>
> When I switched to jdbc:postgresql_postGIS://localhost:5432/testdb,  
> I got:
>
>      [java] 11:38:32,244  WARN JDBCExceptionReporter:77 - SQL  
> Error: 0,
> SQLState: 08001
>      [java] 11:38:32,245 ERROR JDBCExceptionReporter:78 - No  
> suitable driver
>      [java] Exception in thread "main"
> org.hibernate.exception.JDBCConnectionException: Cannot open  
> connection
>      [java]     at
> org.hibernate.exception.SQLStateConverter.convert
> (SQLStateConverter.java:74)
>      [java]     at
> org.hibernate.exception.JDBCExceptionHelper.convert
> (JDBCExceptionHelper.java:43)
>      [java]     at
> org.hibernate.exception.JDBCExceptionHelper.convert
> (JDBCExceptionHelper.java:29)
>      [java]     at
> org.hibernate.jdbc.ConnectionManager.openConnection
> (ConnectionManager.java:426)
>      [java]     at
> org.hibernate.jdbc.ConnectionManager.getConnection
> (ConnectionManager.java:144)
>      [java]     at
> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>      [java]     at
> org.hibernate.transaction.JDBCTransaction.begin
> (JDBCTransaction.java:57)
>      [java]     at
> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>      [java]     at
> sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>      [java]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>      [java]     at
> org.hibernate.context.ThreadLocalSessionContext
> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
> 301)
>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>      [java]     at org.earthserve.model.EventManager.find(Unknown  
> Source)
>      [java]     at org.earthserve.model.EventManager.main(Unknown  
> Source)
>      [java] Caused by: java.sql.SQLException: No suitable driver
>      [java]     at
> java.sql.DriverManager.getConnection(DriverManager.java:545)
>      [java]     at
> java.sql.DriverManager.getConnection(DriverManager.java:140)
>      [java]     at
> org.hibernate.connection.DriverManagerConnectionProvider.getConnection
> (DriverManagerConnectionProvider.java:110)
>      [java]     at
> org.hibernate.jdbc.ConnectionManager.openConnection
> (ConnectionManager.java:423)
>      [java]     ... 12 more
>      [java] Java Result: 1
>
> Cheers,
>
> Greg
>
> Karel Maesen wrote:
>> Hi Greg,
>>
>> The postgresql + postgis do not return PGgeometry (or Geometry)
>> objects but "plain" PGobjects. Since postgis.jar is correctly
>> installed, it seems that the postgresql jdbc driver fails to register
>> the postgis supplied geometry types. Could you check whether you have
>> a 8.0 or higher version of the postgresql JDBC driver?
>>
>> You might also try to change in the jdbc URL  "jdbc:postgresql"
>> into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file). This
>> uses the postgis DriverWrapper which registers the geometry types
>> explicitly.
>>
>> Regards,
>>
>> Karel
>>
>>
>> On 06 Feb 2008, at 20:16, gederer wrote:
>>
>>
>>> Hi Karel,
>>>
>>> Thanks for your reply. Here is the result of the query you sugested:
>>>
>>> testdb=# select title, astext(loc) from events;
>>>   title   |    astext
>>> ----------+--------------
>>>  My Event | POINT(10 15)
>>> (1 row)
>>>
>>> Also, I saw another post on this list where the 'Can't convert
>>> object of
>>> type org.postgresql.util.PGobject' occurred, and the problem was
>>> solved by
>>> placing postgis.jar on the classpath. I checked to be certain, and
>>> I do have
>>> this jar in my lib directory, and ant is able to find it.
>>>
>>> Thanks!
>>>
>>> Greg
>>>
>>>
>>> gederer wrote:
>>>
>>>> Hi,
>>>>
>>>> I'm working off of the tutorial at
>>>> http://www.hibernatespatial.org/tutorial.html.  I have been able
>>>> to load a
>>>> point into the database via:
>>>>
>>>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>>>
>>>> But, when I run:
>>>>
>>>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1  
>>>> 1))"
>>>>
>>>> after modifying the main method and adding the find method, I get
>>>> this
>>>> output:
>>>>
>>>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>>>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as
>>>> title0_0_,
>>>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>>>> within(this_.LOC, ?))
>>>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>>>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,
>>>> this_.LOC as
>>>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>>>> (this_.LOC,
>>>> ?))
>>>>      [java] Exception in thread "main"
>>>> java.lang.IllegalArgumentException:
>>>> Can't convert object of type org.postgresql.util.PGobject
>>>>      [java]     at
>>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>>>> (PGGeometryUserType.java:120)
>>>>      [java]     at
>>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>>> (AbstractDBGeometryType.java:127)
>>>>      [java]     at
>>>> org.hibernatespatial.GeometryUserType.nullSafeGet
>>>> (GeometryUserType.java:170)
>>>>      [java]     at
>>>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>>>      [java]     at
>>>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>>>      [java]     at
>>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>>> (AbstractEntityPersister.java:2096)
>>>>      [java]     at
>>>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>>>      [java]     at
>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
>>>>      [java]     at org.hibernate.loader.Loader.getRow(Loader.java:
>>>> 1206)
>>>>      [java]     at
>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>>>      [java]     at org.hibernate.loader.Loader.doQuery(Loader.java:
>>>> 701)
>>>>      [java]     at
>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
>>>> (Loader.java:236)
>>>>      [java]     at org.hibernate.loader.Loader.doList(Loader.java:
>>>> 2220)
>>>>      [java]     at
>>>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
>>>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:
>>>> 2099)
>>>>      [java]     at
>>>> org.hibernate.loader.criteria.CriteriaLoader.list
>>>> (CriteriaLoader.java:94)
>>>>      [java]     at
>>>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>>>      [java]     at
>>>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>> Source)
>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>> Source)
>>>>      [java] Java Result: 1
>>>>
>>>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from  
>>>> kyngchaos. Any
>>>> suggestions?
>>>>
>>>> Thanks!
>>>>
>>>> Greg
>>>>
>>>>
>>> --
>>> View this message in context: http://www.nabble.com/Can%27t-convert-
>>> object-of-type-org.postgresql.util.PGobject-tp15310652p15311498.html
>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>> Nabble.com.
>>>
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>> hibernatespatial-users
>>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>
>
>
> --
> | E R G O N O S I S
> | Greg Ederer
> | Lead Developer
> | [hidden email]
> | 360.774.6848
> |
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Greg Ederer

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

Reply Threaded More More options
Print post
Permalink
Hi Karel,

I saw somewhere that the driver class also has to be changed.  So, with
this in my build.xml:

        <property
name="connection.driver_class">org.postgis.DriverWrapper</property>
        <property
name="connection.url">jdbc:postgresql_postGIS://localhost:5432/testdb</property>

I get:

     [java] 12:14:35,412  WARN JDBCExceptionReporter:77 - SQL Error: 0,
SQLState: 60000
     [java] 12:14:35,412 ERROR JDBCExceptionReporter:78 - Unable to load
the class org.postgis.PGbox3d responsible for the datatype box3d
     [java] Exception in thread "main"
org.hibernate.exception.GenericJDBCException: Cannot open connection
     [java]     at
org.hibernate.exception.SQLStateConverter.handledNonSpecificException(SQLStateConverter.java:103)
     [java]     at
org.hibernate.exception.SQLStateConverter.convert(SQLStateConverter.java:91)
     [java]     at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
     [java]     at
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:29)
     [java]     at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:426)
     [java]     at
org.hibernate.jdbc.ConnectionManager.getConnection(ConnectionManager.java:144)
     [java]     at
org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
     [java]     at
org.hibernate.transaction.JDBCTransaction.begin(JDBCTransaction.java:57)
     [java]     at
org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
     [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
     [java]     at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
     [java]     at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
     [java]     at java.lang.reflect.Method.invoke(Method.java:585)
     [java]     at
org.hibernate.context.ThreadLocalSessionContext$TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:301)
     [java]     at $Proxy0.beginTransaction(Unknown Source)
     [java]     at org.earthserve.model.EventManager.find(Unknown Source)
     [java]     at org.earthserve.model.EventManager.main(Unknown Source)
     [java] Caused by: org.postgresql.util.PSQLException: Unable to load
the class org.postgis.PGbox3d responsible for the datatype box3d
     [java]     at
org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes(AbstractJdbc2Connection.java:462)
     [java]     at
org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
     [java]     at
org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:30)
     [java]     at
org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
     [java]     at org.postgresql.Driver.makeConnection(Driver.java:369)
     [java]     at org.postgresql.Driver.connect(Driver.java:245)
     [java]     at org.postgis.DriverWrapper.connect(DriverWrapper.java:155)
     [java]     at
java.sql.DriverManager.getConnection(DriverManager.java:525)
     [java]     at
java.sql.DriverManager.getConnection(DriverManager.java:140)
     [java]     at
org.hibernate.connection.DriverManagerConnectionProvider.getConnection(DriverManagerConnectionProvider.java:110)
     [java]     at
org.hibernate.jdbc.ConnectionManager.openConnection(ConnectionManager.java:423)
     [java]     ... 12 more
     [java] Caused by: java.lang.ClassNotFoundException: org.postgis.PGbox3d
     [java]     at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
     [java]     at java.security.AccessController.doPrivileged(Native
Method)
     [java]     at
java.net.URLClassLoader.findClass(URLClassLoader.java:188)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:316)
     [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
     [java]     at
java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
     [java]     at java.lang.Class.forName0(Native Method)
     [java]     at java.lang.Class.forName(Class.java:164)
     [java]     at
org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes(AbstractJdbc2Connection.java:458)
     [java]     ... 22 more
     [java] Java Result: 1

I looked in postgis.jar, and PGbox3d is in there.

Here is the ant classpath:

     [java] Executing
'/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/bin/java'
with arguments:
     [java] '-classpath'
     [java]
'/Users/gregederer/dev/precip/lib/acme.jar:/Users/gregederer/dev/precip/lib/activation.jar:/Users/gregederer/dev/precip/lib/antlr-2.7.6.jar:/Users/gregederer/dev/precip/lib/asm-attrs.jar:/Users/gregederer/dev/precip/lib/asm.jar:/Users/gregederer/dev/precip/lib/c3p0-0.9.1.jar:/Users/gregederer/dev/precip/lib/cglib-2.1.3.jar:/Users/gregederer/dev/precip/lib/commons-beanutils.jar:/Users/gregederer/dev/precip/lib/commons-collections-2.1.1.jar:/Users/gregederer/dev/precip/lib/commons-logging-1.0.4.jar:/Users/gregederer/dev/precip/lib/commons-net-1.4.1.jar:/Users/gregederer/dev/precip/lib/concurrent-1.3.2.jar:/Users/gregederer/dev/precip/lib/dom4j-1.6.1.jar:/Users/gregederer/dev/precip/lib/ehcache-1.2.3.jar:/Users/gregederer/dev/precip/lib/hibernate-spatial-1.0-M1.jar:/Users/gregederer/dev/precip/lib/hibernate-spatial-postgis-1.0-M1.jar:/Users/gregederer/dev/precip/lib/hibernate3.jar:/Users/gregederer/dev/precip/lib/jacc-1_0-fr.jar:/Users/gregederer/dev/precip/lib/javacsv.jar:/Users/gregederer/dev/precip/lib/jaxen-1.1-beta-7.jar:/Users/gregederer/dev/precip/lib/jdbc2_0-stdext.jar:/Users/gregederer/dev/precip/lib/jdom.jar:/Users/gregederer/dev/precip/lib/jta.jar:/Users/gregederer/dev/precip/lib/jts-1.8.jar:/Users/gregederer/dev/precip/lib/jtsio-1.8.jar:/Users/gregederer/dev/precip/lib/jxl.jar:/Users/gregederer/dev/precip/lib/log4j-1.2.11.jar:/Users/gregederer/dev/precip/lib/postgis.jar:/Users/gregederer/dev/precip/lib/postgresql-8.2-508.jdbc3.jar:/Users/gregederer/dev/precip/lib/tar.jar:/Users/gregederer/dev/precip/lib/xerces.jar:/Users/gregederer/dev/precip/lib/xml-apis.jar:/Users/gregederer/dev/precip/bin'

The postgis.jar is there, I see only one postgtresql JDBC driver jar.

Again, thanks!  I think we're getting closer.

Greg

Karel Maesen wrote:

> I just checked. Using "jdbc:postgresql_POSTGIS" doesn't work on my  
> system either.
>
> Is it possible that you have somewhere else a postgresql driver on  
> the classpath (try running ant with the -verbose option)?
>
>
> On 06 Feb 2008, at 20:43, Greg Ederer wrote:
>
>  
>> Hi Karel,
>>
>> I see that ant reports:
>>
>>      [java] 11:08:22,256  INFO SettingsFactory:89 - RDBMS: PostgreSQL,
>> version: 8.2.5
>>      [java] 11:08:22,257  INFO SettingsFactory:90 - JDBC driver:
>> PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL  
>> (build 407)
>>
>> which is odd because I'm using postgresql-8.2-508.jdbc3.jar.
>>
>> When I switched to jdbc:postgresql_postGIS://localhost:5432/testdb,  
>> I got:
>>
>>      [java] 11:38:32,244  WARN JDBCExceptionReporter:77 - SQL  
>> Error: 0,
>> SQLState: 08001
>>      [java] 11:38:32,245 ERROR JDBCExceptionReporter:78 - No  
>> suitable driver
>>      [java] Exception in thread "main"
>> org.hibernate.exception.JDBCConnectionException: Cannot open  
>> connection
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.convert
>> (SQLStateConverter.java:74)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:43)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:29)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:426)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.getConnection
>> (ConnectionManager.java:144)
>>      [java]     at
>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>      [java]     at
>> org.hibernate.transaction.JDBCTransaction.begin
>> (JDBCTransaction.java:57)
>>      [java]     at
>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>      [java]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>      [java]     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>      [java]     at
>> org.hibernate.context.ThreadLocalSessionContext
>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>> 301)
>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>      [java]     at org.earthserve.model.EventManager.find(Unknown  
>> Source)
>>      [java]     at org.earthserve.model.EventManager.main(Unknown  
>> Source)
>>      [java] Caused by: java.sql.SQLException: No suitable driver
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:545)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>      [java]     at
>> org.hibernate.connection.DriverManagerConnectionProvider.getConnection
>> (DriverManagerConnectionProvider.java:110)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:423)
>>      [java]     ... 12 more
>>      [java] Java Result: 1
>>
>> Cheers,
>>
>> Greg
>>
>> Karel Maesen wrote:
>>    
>>> Hi Greg,
>>>
>>> The postgresql + postgis do not return PGgeometry (or Geometry)
>>> objects but "plain" PGobjects. Since postgis.jar is correctly
>>> installed, it seems that the postgresql jdbc driver fails to register
>>> the postgis supplied geometry types. Could you check whether you have
>>> a 8.0 or higher version of the postgresql JDBC driver?
>>>
>>> You might also try to change in the jdbc URL  "jdbc:postgresql"
>>> into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file). This
>>> uses the postgis DriverWrapper which registers the geometry types
>>> explicitly.
>>>
>>> Regards,
>>>
>>> Karel
>>>
>>>
>>> On 06 Feb 2008, at 20:16, gederer wrote:
>>>
>>>
>>>      
>>>> Hi Karel,
>>>>
>>>> Thanks for your reply. Here is the result of the query you sugested:
>>>>
>>>> testdb=# select title, astext(loc) from events;
>>>>   title   |    astext
>>>> ----------+--------------
>>>>  My Event | POINT(10 15)
>>>> (1 row)
>>>>
>>>> Also, I saw another post on this list where the 'Can't convert
>>>> object of
>>>> type org.postgresql.util.PGobject' occurred, and the problem was
>>>> solved by
>>>> placing postgis.jar on the classpath. I checked to be certain, and
>>>> I do have
>>>> this jar in my lib directory, and ant is able to find it.
>>>>
>>>> Thanks!
>>>>
>>>> Greg
>>>>
>>>>
>>>> gederer wrote:
>>>>
>>>>        
>>>>> Hi,
>>>>>
>>>>> I'm working off of the tutorial at
>>>>> http://www.hibernatespatial.org/tutorial.html.  I have been able
>>>>> to load a
>>>>> point into the database via:
>>>>>
>>>>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>>>>
>>>>> But, when I run:
>>>>>
>>>>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1  
>>>>> 1))"
>>>>>
>>>>> after modifying the main method and adding the find method, I get
>>>>> this
>>>>> output:
>>>>>
>>>>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>>>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>>>>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as
>>>>> title0_0_,
>>>>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>>>>> within(this_.LOC, ?))
>>>>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>>>>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,
>>>>> this_.LOC as
>>>>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>>>>> (this_.LOC,
>>>>> ?))
>>>>>      [java] Exception in thread "main"
>>>>> java.lang.IllegalArgumentException:
>>>>> Can't convert object of type org.postgresql.util.PGobject
>>>>>      [java]     at
>>>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>>>>> (PGGeometryUserType.java:120)
>>>>>      [java]     at
>>>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>>>> (AbstractDBGeometryType.java:127)
>>>>>      [java]     at
>>>>> org.hibernatespatial.GeometryUserType.nullSafeGet
>>>>> (GeometryUserType.java:170)
>>>>>      [java]     at
>>>>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>>>>      [java]     at
>>>>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>>>>      [java]     at
>>>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>>>> (AbstractEntityPersister.java:2096)
>>>>>      [java]     at
>>>>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>>>>      [java]     at
>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
>>>>>      [java]     at org.hibernate.loader.Loader.getRow(Loader.java:
>>>>> 1206)
>>>>>      [java]     at
>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>>>>      [java]     at org.hibernate.loader.Loader.doQuery(Loader.java:
>>>>> 701)
>>>>>      [java]     at
>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
>>>>> (Loader.java:236)
>>>>>      [java]     at org.hibernate.loader.Loader.doList(Loader.java:
>>>>> 2220)
>>>>>      [java]     at
>>>>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
>>>>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:
>>>>> 2099)
>>>>>      [java]     at
>>>>> org.hibernate.loader.criteria.CriteriaLoader.list
>>>>> (CriteriaLoader.java:94)
>>>>>      [java]     at
>>>>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>>>>      [java]     at
>>>>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>>> Source)
>>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>>> Source)
>>>>>      [java] Java Result: 1
>>>>>
>>>>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from  
>>>>> kyngchaos. Any
>>>>> suggestions?
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Greg
>>>>>
>>>>>
>>>>>          
>>>> --
>>>> View this message in context: http://www.nabble.com/Can%27t-convert-
>>>> object-of-type-org.postgresql.util.PGobject-tp15310652p15311498.html
>>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>>> Nabble.com.
>>>>
>>>> _______________________________________________
>>>> hibernatespatial-users mailing list
>>>> [hidden email]
>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>> hibernatespatial-users
>>>>
>>>>        
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>>> hibernatespatial-users
>>>
>>>      
>> --
>> | E R G O N O S I S
>> | Greg Ederer
>> | Lead Developer
>> | [hidden email]
>> | 360.774.6848
>> |
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>    
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>  


--
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| [hidden email]
| 360.774.6848
|


_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Karel Maesen

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

Reply Threaded More More options
Print post
Permalink
With driver class property changed, the DriverWrapper now works on my  
side. (And I'm also on an OS X system)

Clearly the problem is that the Postgis extension types fail to load  
in the postgresql driver for some reason. So this looks like a  
postgresql/postgis problem. I would try with slightly older versions  
of the postgis and postgresql-jdbc jars.

If none of that works, I should try to write a simple JDBC/Postgis  
program and see if you have the same type of problem there (check the  
postgis documentation for examples). If so, you could also ask for  
help on the postgis mailing list.

On 06 Feb 2008, at 21:30, Greg Ederer wrote:

> Hi Karel,
>
> I saw somewhere that the driver class also has to be changed.  So,  
> with
> this in my build.xml:
>
>         <property
> name="connection.driver_class">org.postgis.DriverWrapper</property>
>         <property
> name="connection.url">jdbc:postgresql_postGIS://localhost:5432/
> testdb</property>
>
> I get:
>
>      [java] 12:14:35,412  WARN JDBCExceptionReporter:77 - SQL  
> Error: 0,
> SQLState: 60000
>      [java] 12:14:35,412 ERROR JDBCExceptionReporter:78 - Unable to  
> load
> the class org.postgis.PGbox3d responsible for the datatype box3d
>      [java] Exception in thread "main"
> org.hibernate.exception.GenericJDBCException: Cannot open connection
>      [java]     at
> org.hibernate.exception.SQLStateConverter.handledNonSpecificException(
> SQLStateConverter.java:103)
>      [java]     at
> org.hibernate.exception.SQLStateConverter.convert
> (SQLStateConverter.java:91)
>      [java]     at
> org.hibernate.exception.JDBCExceptionHelper.convert
> (JDBCExceptionHelper.java:43)
>      [java]     at
> org.hibernate.exception.JDBCExceptionHelper.convert
> (JDBCExceptionHelper.java:29)
>      [java]     at
> org.hibernate.jdbc.ConnectionManager.openConnection
> (ConnectionManager.java:426)
>      [java]     at
> org.hibernate.jdbc.ConnectionManager.getConnection
> (ConnectionManager.java:144)
>      [java]     at
> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>      [java]     at
> org.hibernate.transaction.JDBCTransaction.begin
> (JDBCTransaction.java:57)
>      [java]     at
> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>      [java]     at
> sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
>      [java]     at
> sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>      [java]     at
> org.hibernate.context.ThreadLocalSessionContext
> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
> 301)
>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>      [java]     at org.earthserve.model.EventManager.find(Unknown  
> Source)
>      [java]     at org.earthserve.model.EventManager.main(Unknown  
> Source)
>      [java] Caused by: org.postgresql.util.PSQLException: Unable to  
> load
> the class org.postgis.PGbox3d responsible for the datatype box3d
>      [java]     at
> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
> (AbstractJdbc2Connection.java:462)
>      [java]     at
> org.postgresql.jdbc2.AbstractJdbc2Connection.<init>
> (AbstractJdbc2Connection.java:136)
>      [java]     at
> org.postgresql.jdbc3.AbstractJdbc3Connection.<init>
> (AbstractJdbc3Connection.java:30)
>      [java]     at
> org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
>      [java]     at org.postgresql.Driver.makeConnection(Driver.java:
> 369)
>      [java]     at org.postgresql.Driver.connect(Driver.java:245)
>      [java]     at org.postgis.DriverWrapper.connect
> (DriverWrapper.java:155)
>      [java]     at
> java.sql.DriverManager.getConnection(DriverManager.java:525)
>      [java]     at
> java.sql.DriverManager.getConnection(DriverManager.java:140)
>      [java]     at
> org.hibernate.connection.DriverManagerConnectionProvider.getConnection
> (DriverManagerConnectionProvider.java:110)
>      [java]     at
> org.hibernate.jdbc.ConnectionManager.openConnection
> (ConnectionManager.java:423)
>      [java]     ... 12 more
>      [java] Caused by: java.lang.ClassNotFoundException:  
> org.postgis.PGbox3d
>      [java]     at java.net.URLClassLoader$1.run
> (URLClassLoader.java:200)
>      [java]     at java.security.AccessController.doPrivileged(Native
> Method)
>      [java]     at
> java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
> 316)
>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
> 251)
>      [java]     at
> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
>      [java]     at java.lang.Class.forName0(Native Method)
>      [java]     at java.lang.Class.forName(Class.java:164)
>      [java]     at
> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
> (AbstractJdbc2Connection.java:458)
>      [java]     ... 22 more
>      [java] Java Result: 1
>
> I looked in postgis.jar, and PGbox3d is in there.
>
> Here is the ant classpath:
>
>      [java] Executing
> '/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/
> bin/java'
> with arguments:
>      [java] '-classpath'
>      [java]
> '/Users/gregederer/dev/precip/lib/acme.jar:/Users/gregederer/dev/
> precip/lib/activation.jar:/Users/gregederer/dev/precip/lib/
> antlr-2.7.6.jar:/Users/gregederer/dev/precip/lib/asm-attrs.jar:/
> Users/gregederer/dev/precip/lib/asm.jar:/Users/gregederer/dev/
> precip/lib/c3p0-0.9.1.jar:/Users/gregederer/dev/precip/lib/
> cglib-2.1.3.jar:/Users/gregederer/dev/precip/lib/commons-
> beanutils.jar:/Users/gregederer/dev/precip/lib/commons-
> collections-2.1.1.jar:/Users/gregederer/dev/precip/lib/commons-
> logging-1.0.4.jar:/Users/gregederer/dev/precip/lib/commons-
> net-1.4.1.jar:/Users/gregederer/dev/precip/lib/
> concurrent-1.3.2.jar:/Users/gregederer/dev/precip/lib/
> dom4j-1.6.1.jar:/Users/gregederer/dev/precip/lib/ehcache-1.2.3.jar:/
> Users/gregederer/dev/precip/lib/hibernate-spatial-1.0-M1.jar:/Users/
> gregederer/dev/precip/lib/hibernate-spatial-postgis-1.0-M1.jar:/
> Users/gregederer/dev/precip/lib/hibernate3.jar:/Users/gregederer/
> dev/precip/lib/jacc-1_0-fr.jar:/Users/gregederer/dev/precip/lib/
> javacsv.jar:/Users/gregederer/dev/precip/lib/jaxen-1.1-beta-7.jar:/
> Users/gregederer/dev/precip/lib/jdbc2_0-stdext.jar:/Users/
> gregederer/dev/precip/lib/jdom.jar:/Users/gregederer/dev/precip/lib/
> jta.jar:/Users/gregederer/dev/precip/lib/jts-1.8.jar:/Users/
> gregederer/dev/precip/lib/jtsio-1.8.jar:/Users/gregederer/dev/
> precip/lib/jxl.jar:/Users/gregederer/dev/precip/lib/
> log4j-1.2.11.jar:/Users/gregederer/dev/precip/lib/postgis.jar:/
> Users/gregederer/dev/precip/lib/postgresql-8.2-508.jdbc3.jar:/Users/
> gregederer/dev/precip/lib/tar.jar:/Users/gregederer/dev/precip/lib/
> xerces.jar:/Users/gregederer/dev/precip/lib/xml-apis.jar:/Users/
> gregederer/dev/precip/bin'
>
> The postgis.jar is there, I see only one postgtresql JDBC driver jar.
>
> Again, thanks!  I think we're getting closer.
>
> Greg
>
> Karel Maesen wrote:
>> I just checked. Using "jdbc:postgresql_POSTGIS" doesn't work on my
>> system either.
>>
>> Is it possible that you have somewhere else a postgresql driver on
>> the classpath (try running ant with the -verbose option)?
>>
>>
>> On 06 Feb 2008, at 20:43, Greg Ederer wrote:
>>
>>
>>> Hi Karel,
>>>
>>> I see that ant reports:
>>>
>>>      [java] 11:08:22,256  INFO SettingsFactory:89 - RDBMS:  
>>> PostgreSQL,
>>> version: 8.2.5
>>>      [java] 11:08:22,257  INFO SettingsFactory:90 - JDBC driver:
>>> PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL
>>> (build 407)
>>>
>>> which is odd because I'm using postgresql-8.2-508.jdbc3.jar.
>>>
>>> When I switched to jdbc:postgresql_postGIS://localhost:5432/testdb,
>>> I got:
>>>
>>>      [java] 11:38:32,244  WARN JDBCExceptionReporter:77 - SQL
>>> Error: 0,
>>> SQLState: 08001
>>>      [java] 11:38:32,245 ERROR JDBCExceptionReporter:78 - No
>>> suitable driver
>>>      [java] Exception in thread "main"
>>> org.hibernate.exception.JDBCConnectionException: Cannot open
>>> connection
>>>      [java]     at
>>> org.hibernate.exception.SQLStateConverter.convert
>>> (SQLStateConverter.java:74)
>>>      [java]     at
>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>> (JDBCExceptionHelper.java:43)
>>>      [java]     at
>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>> (JDBCExceptionHelper.java:29)
>>>      [java]     at
>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>> (ConnectionManager.java:426)
>>>      [java]     at
>>> org.hibernate.jdbc.ConnectionManager.getConnection
>>> (ConnectionManager.java:144)
>>>      [java]     at
>>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>>      [java]     at
>>> org.hibernate.transaction.JDBCTransaction.begin
>>> (JDBCTransaction.java:57)
>>>      [java]     at
>>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:
>>> 1326)
>>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0
>>> (Native
>>> Method)
>>>      [java]     at
>>> sun.reflect.NativeMethodAccessorImpl.invoke
>>> (NativeMethodAccessorImpl.java:39)
>>>      [java]     at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>>> (DelegatingMethodAccessorImpl.java:25)
>>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>>      [java]     at
>>> org.hibernate.context.ThreadLocalSessionContext
>>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>>> 301)
>>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>> Source)
>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>> Source)
>>>      [java] Caused by: java.sql.SQLException: No suitable driver
>>>      [java]     at
>>> java.sql.DriverManager.getConnection(DriverManager.java:545)
>>>      [java]     at
>>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>>      [java]     at
>>> org.hibernate.connection.DriverManagerConnectionProvider.getConnecti
>>> on
>>> (DriverManagerConnectionProvider.java:110)
>>>      [java]     at
>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>> (ConnectionManager.java:423)
>>>      [java]     ... 12 more
>>>      [java] Java Result: 1
>>>
>>> Cheers,
>>>
>>> Greg
>>>
>>> Karel Maesen wrote:
>>>
>>>> Hi Greg,
>>>>
>>>> The postgresql + postgis do not return PGgeometry (or Geometry)
>>>> objects but "plain" PGobjects. Since postgis.jar is correctly
>>>> installed, it seems that the postgresql jdbc driver fails to  
>>>> register
>>>> the postgis supplied geometry types. Could you check whether you  
>>>> have
>>>> a 8.0 or higher version of the postgresql JDBC driver?
>>>>
>>>> You might also try to change in the jdbc URL  "jdbc:postgresql"
>>>> into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file).  
>>>> This
>>>> uses the postgis DriverWrapper which registers the geometry types
>>>> explicitly.
>>>>
>>>> Regards,
>>>>
>>>> Karel
>>>>
>>>>
>>>> On 06 Feb 2008, at 20:16, gederer wrote:
>>>>
>>>>
>>>>
>>>>> Hi Karel,
>>>>>
>>>>> Thanks for your reply. Here is the result of the query you  
>>>>> sugested:
>>>>>
>>>>> testdb=# select title, astext(loc) from events;
>>>>>   title   |    astext
>>>>> ----------+--------------
>>>>>  My Event | POINT(10 15)
>>>>> (1 row)
>>>>>
>>>>> Also, I saw another post on this list where the 'Can't convert
>>>>> object of
>>>>> type org.postgresql.util.PGobject' occurred, and the problem was
>>>>> solved by
>>>>> placing postgis.jar on the classpath. I checked to be certain, and
>>>>> I do have
>>>>> this jar in my lib directory, and ant is able to find it.
>>>>>
>>>>> Thanks!
>>>>>
>>>>> Greg
>>>>>
>>>>>
>>>>> gederer wrote:
>>>>>
>>>>>
>>>>>> Hi,
>>>>>>
>>>>>> I'm working off of the tutorial at
>>>>>> http://www.hibernatespatial.org/tutorial.html.  I have been able
>>>>>> to load a
>>>>>> point into the database via:
>>>>>>
>>>>>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>>>>>
>>>>>> But, when I run:
>>>>>>
>>>>>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1
>>>>>> 1))"
>>>>>>
>>>>>> after modifying the main method and adding the find method, I get
>>>>>> this
>>>>>> output:
>>>>>>
>>>>>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>>>>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>>>>>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as
>>>>>> title0_0_,
>>>>>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>>>>>> within(this_.LOC, ?))
>>>>>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>>>>>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,
>>>>>> this_.LOC as
>>>>>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>>>>>> (this_.LOC,
>>>>>> ?))
>>>>>>      [java] Exception in thread "main"
>>>>>> java.lang.IllegalArgumentException:
>>>>>> Can't convert object of type org.postgresql.util.PGobject
>>>>>>      [java]     at
>>>>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>>>>>> (PGGeometryUserType.java:120)
>>>>>>      [java]     at
>>>>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>>>>> (AbstractDBGeometryType.java:127)
>>>>>>      [java]     at
>>>>>> org.hibernatespatial.GeometryUserType.nullSafeGet
>>>>>> (GeometryUserType.java:170)
>>>>>>      [java]     at
>>>>>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>>>>>      [java]     at
>>>>>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>>>>>      [java]     at
>>>>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>>>>> (AbstractEntityPersister.java:2096)
>>>>>>      [java]     at
>>>>>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>>>>>      [java]     at
>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:
>>>>>> 1308)
>>>>>>      [java]     at org.hibernate.loader.Loader.getRow
>>>>>> (Loader.java:
>>>>>> 1206)
>>>>>>      [java]     at
>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>>>>>      [java]     at org.hibernate.loader.Loader.doQuery
>>>>>> (Loader.java:
>>>>>> 701)
>>>>>>      [java]     at
>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollection
>>>>>> s
>>>>>> (Loader.java:236)
>>>>>>      [java]     at org.hibernate.loader.Loader.doList
>>>>>> (Loader.java:
>>>>>> 2220)
>>>>>>      [java]     at
>>>>>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:
>>>>>> 2104)
>>>>>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:
>>>>>> 2099)
>>>>>>      [java]     at
>>>>>> org.hibernate.loader.criteria.CriteriaLoader.list
>>>>>> (CriteriaLoader.java:94)
>>>>>>      [java]     at
>>>>>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>>>>>      [java]     at
>>>>>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>>>> Source)
>>>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>>>> Source)
>>>>>>      [java] Java Result: 1
>>>>>>
>>>>>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from
>>>>>> kyngchaos. Any
>>>>>> suggestions?
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Greg
>>>>>>
>>>>>>
>>>>>>
>>>>> --
>>>>> View this message in context: http://www.nabble.com/Can%27t- 
>>>>> convert-
>>>>> object-of-type-org.postgresql.util.PGobject-
>>>>> tp15310652p15311498.html
>>>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>>>> Nabble.com.
>>>>>
>>>>> _______________________________________________
>>>>> hibernatespatial-users mailing list
>>>>> [hidden email]
>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>> hibernatespatial-users
>>>>>
>>>>>
>>>> _______________________________________________
>>>> hibernatespatial-users mailing list
>>>> [hidden email]
>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>> hibernatespatial-users
>>>>
>>>>
>>> --
>>> | E R G O N O S I S
>>> | Greg Ederer
>>> | Lead Developer
>>> | [hidden email]
>>> | 360.774.6848
>>> |
>>>
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>> hibernatespatial-users
>>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>
>
>
> --
> | E R G O N O S I S
> | Greg Ederer
> | Lead Developer
> | [hidden email]
> | 360.774.6848
> |
>
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Greg Ederer

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

Reply Threaded More More options
Print post
Permalink
Hi Karel,

Thank you so much for all your help.  I'll try your suggestions.

Cheers,

Greg

Karel Maesen wrote:

> With driver class property changed, the DriverWrapper now works on my  
> side. (And I'm also on an OS X system)
>
> Clearly the problem is that the Postgis extension types fail to load  
> in the postgresql driver for some reason. So this looks like a  
> postgresql/postgis problem. I would try with slightly older versions  
> of the postgis and postgresql-jdbc jars.
>
> If none of that works, I should try to write a simple JDBC/Postgis  
> program and see if you have the same type of problem there (check the  
> postgis documentation for examples). If so, you could also ask for  
> help on the postgis mailing list.
>
> On 06 Feb 2008, at 21:30, Greg Ederer wrote:
>
>  
>> Hi Karel,
>>
>> I saw somewhere that the driver class also has to be changed.  So,  
>> with
>> this in my build.xml:
>>
>>         <property
>> name="connection.driver_class">org.postgis.DriverWrapper</property>
>>         <property
>> name="connection.url">jdbc:postgresql_postGIS://localhost:5432/
>> testdb</property>
>>
>> I get:
>>
>>      [java] 12:14:35,412  WARN JDBCExceptionReporter:77 - SQL  
>> Error: 0,
>> SQLState: 60000
>>      [java] 12:14:35,412 ERROR JDBCExceptionReporter:78 - Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java] Exception in thread "main"
>> org.hibernate.exception.GenericJDBCException: Cannot open connection
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.handledNonSpecificException(
>> SQLStateConverter.java:103)
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.convert
>> (SQLStateConverter.java:91)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:43)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:29)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:426)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.getConnection
>> (ConnectionManager.java:144)
>>      [java]     at
>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>      [java]     at
>> org.hibernate.transaction.JDBCTransaction.begin
>> (JDBCTransaction.java:57)
>>      [java]     at
>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>      [java]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>      [java]     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>      [java]     at
>> org.hibernate.context.ThreadLocalSessionContext
>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>> 301)
>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>      [java]     at org.earthserve.model.EventManager.find(Unknown  
>> Source)
>>      [java]     at org.earthserve.model.EventManager.main(Unknown  
>> Source)
>>      [java] Caused by: org.postgresql.util.PSQLException: Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:462)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.<init>
>> (AbstractJdbc2Connection.java:136)
>>      [java]     at
>> org.postgresql.jdbc3.AbstractJdbc3Connection.<init>
>> (AbstractJdbc3Connection.java:30)
>>      [java]     at
>> org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
>>      [java]     at org.postgresql.Driver.makeConnection(Driver.java:
>> 369)
>>      [java]     at org.postgresql.Driver.connect(Driver.java:245)
>>      [java]     at org.postgis.DriverWrapper.connect
>> (DriverWrapper.java:155)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:525)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>      [java]     at
>> org.hibernate.connection.DriverManagerConnectionProvider.getConnection
>> (DriverManagerConnectionProvider.java:110)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:423)
>>      [java]     ... 12 more
>>      [java] Caused by: java.lang.ClassNotFoundException:  
>> org.postgis.PGbox3d
>>      [java]     at java.net.URLClassLoader$1.run
>> (URLClassLoader.java:200)
>>      [java]     at java.security.AccessController.doPrivileged(Native
>> Method)
>>      [java]     at
>> java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 316)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 251)
>>      [java]     at
>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
>>      [java]     at java.lang.Class.forName0(Native Method)
>>      [java]     at java.lang.Class.forName(Class.java:164)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:458)
>>      [java]     ... 22 more
>>      [java] Java Result: 1
>>
>> I looked in postgis.jar, and PGbox3d is in there.
>>
>> Here is the ant classpath:
>>
>>      [java] Executing
>> '/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/
>> bin/java'
>> with arguments:
>>      [java] '-classpath'
>>      [java]
>> '/Users/gregederer/dev/precip/lib/acme.jar:/Users/gregederer/dev/
>> precip/lib/activation.jar:/Users/gregederer/dev/precip/lib/
>> antlr-2.7.6.jar:/Users/gregederer/dev/precip/lib/asm-attrs.jar:/
>> Users/gregederer/dev/precip/lib/asm.jar:/Users/gregederer/dev/
>> precip/lib/c3p0-0.9.1.jar:/Users/gregederer/dev/precip/lib/
>> cglib-2.1.3.jar:/Users/gregederer/dev/precip/lib/commons-
>> beanutils.jar:/Users/gregederer/dev/precip/lib/commons-
>> collections-2.1.1.jar:/Users/gregederer/dev/precip/lib/commons-
>> logging-1.0.4.jar:/Users/gregederer/dev/precip/lib/commons-
>> net-1.4.1.jar:/Users/gregederer/dev/precip/lib/
>> concurrent-1.3.2.jar:/Users/gregederer/dev/precip/lib/
>> dom4j-1.6.1.jar:/Users/gregederer/dev/precip/lib/ehcache-1.2.3.jar:/
>> Users/gregederer/dev/precip/lib/hibernate-spatial-1.0-M1.jar:/Users/
>> gregederer/dev/precip/lib/hibernate-spatial-postgis-1.0-M1.jar:/
>> Users/gregederer/dev/precip/lib/hibernate3.jar:/Users/gregederer/
>> dev/precip/lib/jacc-1_0-fr.jar:/Users/gregederer/dev/precip/lib/
>> javacsv.jar:/Users/gregederer/dev/precip/lib/jaxen-1.1-beta-7.jar:/
>> Users/gregederer/dev/precip/lib/jdbc2_0-stdext.jar:/Users/
>> gregederer/dev/precip/lib/jdom.jar:/Users/gregederer/dev/precip/lib/
>> jta.jar:/Users/gregederer/dev/precip/lib/jts-1.8.jar:/Users/
>> gregederer/dev/precip/lib/jtsio-1.8.jar:/Users/gregederer/dev/
>> precip/lib/jxl.jar:/Users/gregederer/dev/precip/lib/
>> log4j-1.2.11.jar:/Users/gregederer/dev/precip/lib/postgis.jar:/
>> Users/gregederer/dev/precip/lib/postgresql-8.2-508.jdbc3.jar:/Users/
>> gregederer/dev/precip/lib/tar.jar:/Users/gregederer/dev/precip/lib/
>> xerces.jar:/Users/gregederer/dev/precip/lib/xml-apis.jar:/Users/
>> gregederer/dev/precip/bin'
>>
>> The postgis.jar is there, I see only one postgtresql JDBC driver jar.
>>
>> Again, thanks!  I think we're getting closer.
>>
>> Greg
>>
>> Karel Maesen wrote:
>>    
>>> I just checked. Using "jdbc:postgresql_POSTGIS" doesn't work on my
>>> system either.
>>>
>>> Is it possible that you have somewhere else a postgresql driver on
>>> the classpath (try running ant with the -verbose option)?
>>>
>>>
>>> On 06 Feb 2008, at 20:43, Greg Ederer wrote:
>>>
>>>
>>>      
>>>> Hi Karel,
>>>>
>>>> I see that ant reports:
>>>>
>>>>      [java] 11:08:22,256  INFO SettingsFactory:89 - RDBMS:  
>>>> PostgreSQL,
>>>> version: 8.2.5
>>>>      [java] 11:08:22,257  INFO SettingsFactory:90 - JDBC driver:
>>>> PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL
>>>> (build 407)
>>>>
>>>> which is odd because I'm using postgresql-8.2-508.jdbc3.jar.
>>>>
>>>> When I switched to jdbc:postgresql_postGIS://localhost:5432/testdb,
>>>> I got:
>>>>
>>>>      [java] 11:38:32,244  WARN JDBCExceptionReporter:77 - SQL
>>>> Error: 0,
>>>> SQLState: 08001
>>>>      [java] 11:38:32,245 ERROR JDBCExceptionReporter:78 - No
>>>> suitable driver
>>>>      [java] Exception in thread "main"
>>>> org.hibernate.exception.JDBCConnectionException: Cannot open
>>>> connection
>>>>      [java]     at
>>>> org.hibernate.exception.SQLStateConverter.convert
>>>> (SQLStateConverter.java:74)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:43)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:29)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:426)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.getConnection
>>>> (ConnectionManager.java:144)
>>>>      [java]     at
>>>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>>>      [java]     at
>>>> org.hibernate.transaction.JDBCTransaction.begin
>>>> (JDBCTransaction.java:57)
>>>>      [java]     at
>>>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:
>>>> 1326)
>>>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0
>>>> (Native
>>>> Method)
>>>>      [java]     at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>      [java]     at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>>>      [java]     at
>>>> org.hibernate.context.ThreadLocalSessionContext
>>>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>>>> 301)
>>>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>> Source)
>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>> Source)
>>>>      [java] Caused by: java.sql.SQLException: No suitable driver
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:545)
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>>>      [java]     at
>>>> org.hibernate.connection.DriverManagerConnectionProvider.getConnecti
>>>> on
>>>> (DriverManagerConnectionProvider.java:110)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:423)
>>>>      [java]     ... 12 more
>>>>      [java] Java Result: 1
>>>>
>>>> Cheers,
>>>>
>>>> Greg
>>>>
>>>> Karel Maesen wrote:
>>>>
>>>>        
>>>>> Hi Greg,
>>>>>
>>>>> The postgresql + postgis do not return PGgeometry (or Geometry)
>>>>> objects but "plain" PGobjects. Since postgis.jar is correctly
>>>>> installed, it seems that the postgresql jdbc driver fails to  
>>>>> register
>>>>> the postgis supplied geometry types. Could you check whether you  
>>>>> have
>>>>> a 8.0 or higher version of the postgresql JDBC driver?
>>>>>
>>>>> You might also try to change in the jdbc URL  "jdbc:postgresql"
>>>>> into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file).  
>>>>> This
>>>>> uses the postgis DriverWrapper which registers the geometry types
>>>>> explicitly.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Karel
>>>>>
>>>>>
>>>>> On 06 Feb 2008, at 20:16, gederer wrote:
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>> Hi Karel,
>>>>>>
>>>>>> Thanks for your reply. Here is the result of the query you  
>>>>>> sugested:
>>>>>>
>>>>>> testdb=# select title, astext(loc) from events;
>>>>>>   title   |    astext
>>>>>> ----------+--------------
>>>>>>  My Event | POINT(10 15)
>>>>>> (1 row)
>>>>>>
>>>>>> Also, I saw another post on this list where the 'Can't convert
>>>>>> object of
>>>>>> type org.postgresql.util.PGobject' occurred, and the problem was
>>>>>> solved by
>>>>>> placing postgis.jar on the classpath. I checked to be certain, and
>>>>>> I do have
>>>>>> this jar in my lib directory, and ant is able to find it.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Greg
>>>>>>
>>>>>>
>>>>>> gederer wrote:
>>>>>>
>>>>>>
>>>>>>            
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm working off of the tutorial at
>>>>>>> http://www.hibernatespatial.org/tutorial.html.  I have been able
>>>>>>> to load a
>>>>>>> point into the database via:
>>>>>>>
>>>>>>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>>>>>>
>>>>>>> But, when I run:
>>>>>>>
>>>>>>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1
>>>>>>> 1))"
>>>>>>>
>>>>>>> after modifying the main method and adding the find method, I get
>>>>>>> this
>>>>>>> output:
>>>>>>>
>>>>>>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>>>>>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>>>>>>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as
>>>>>>> title0_0_,
>>>>>>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>>>>>>> within(this_.LOC, ?))
>>>>>>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>>>>>>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,
>>>>>>> this_.LOC as
>>>>>>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>>>>>>> (this_.LOC,
>>>>>>> ?))
>>>>>>>      [java] Exception in thread "main"
>>>>>>> java.lang.IllegalArgumentException:
>>>>>>> Can't convert object of type org.postgresql.util.PGobject
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>>>>>>> (PGGeometryUserType.java:120)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>>>>>> (AbstractDBGeometryType.java:127)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.GeometryUserType.nullSafeGet
>>>>>>> (GeometryUserType.java:170)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>>>>>> (AbstractEntityPersister.java:2096)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:
>>>>>>> 1308)
>>>>>>>      [java]     at org.hibernate.loader.Loader.getRow
>>>>>>> (Loader.java:
>>>>>>> 1206)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doQuery
>>>>>>> (Loader.java:
>>>>>>> 701)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollection
>>>>>>> s
>>>>>>> (Loader.java:236)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doList
>>>>>>> (Loader.java:
>>>>>>> 2220)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:
>>>>>>> 2104)
>>>>>>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:
>>>>>>> 2099)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.criteria.CriteriaLoader.list
>>>>>>> (CriteriaLoader.java:94)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>>>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>>>>> Source)
>>>>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>>>>> Source)
>>>>>>>      [java] Java Result: 1
>>>>>>>
>>>>>>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from
>>>>>>> kyngchaos. Any
>>>>>>> suggestions?
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> Greg
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>> --
>>>>>> View this message in context: http://www.nabble.com/Can%27t- 
>>>>>> convert-
>>>>>> object-of-type-org.postgresql.util.PGobject-
>>>>>> tp15310652p15311498.html
>>>>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>>>>> Nabble.com.
>>>>>>
>>>>>> _______________________________________________
>>>>>> hibernatespatial-users mailing list
>>>>>> [hidden email]
>>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>>> hibernatespatial-users
>>>>>>
>>>>>>
>>>>>>            
>>>>> _______________________________________________
>>>>> hibernatespatial-users mailing list
>>>>> [hidden email]
>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>> hibernatespatial-users
>>>>>
>>>>>
>>>>>          
>>>> --
>>>> | E R G O N O S I S
>>>> | Greg Ederer
>>>> | Lead Developer
>>>> | [hidden email]
>>>> | 360.774.6848
>>>> |
>>>>
>>>> _______________________________________________
>>>> hibernatespatial-users mailing list
>>>> [hidden email]
>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>> hibernatespatial-users
>>>>
>>>>        
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>>> hibernatespatial-users
>>>
>>>      
>> --
>> | E R G O N O S I S
>> | Greg Ederer
>> | Lead Developer
>> | [hidden email]
>> | 360.774.6848
>> |
>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>    
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>  


--
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| [hidden email]
| 360.774.6848
|

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Greg Ederer

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Karel Maesen
Hi Karel,

Are you using the kyngchaos PostgreSQL and PostGIS distributions?  If
so, where did you get your postgis.jar?  I could not find one, and so
downloaded the sources for PostgreSQL 2.5 and built my own.  I am
wondering whether this may be the cause of my problems.

Otherwise, what did you use to install PostgreSQL and PostGIS?  Did you
simply compile the sources, or use did you use some other binary installer?

I posted a message to postgis-users but have not received a reply.

Thanks, again.

Greg

Karel Maesen wrote:

> With driver class property changed, the DriverWrapper now works on my  
> side. (And I'm also on an OS X system)
>
> Clearly the problem is that the Postgis extension types fail to load  
> in the postgresql driver for some reason. So this looks like a  
> postgresql/postgis problem. I would try with slightly older versions  
> of the postgis and postgresql-jdbc jars.
>
> If none of that works, I should try to write a simple JDBC/Postgis  
> program and see if you have the same type of problem there (check the  
> postgis documentation for examples). If so, you could also ask for  
> help on the postgis mailing list.
>
> On 06 Feb 2008, at 21:30, Greg Ederer wrote:
>
>  
>> Hi Karel,
>>
>> I saw somewhere that the driver class also has to be changed.  So,  
>> with
>> this in my build.xml:
>>
>>         <property
>> name="connection.driver_class">org.postgis.DriverWrapper</property>
>>         <property
>> name="connection.url">jdbc:postgresql_postGIS://localhost:5432/
>> testdb</property>
>>
>> I get:
>>
>>      [java] 12:14:35,412  WARN JDBCExceptionReporter:77 - SQL  
>> Error: 0,
>> SQLState: 60000
>>      [java] 12:14:35,412 ERROR JDBCExceptionReporter:78 - Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java] Exception in thread "main"
>> org.hibernate.exception.GenericJDBCException: Cannot open connection
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.handledNonSpecificException(
>> SQLStateConverter.java:103)
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.convert
>> (SQLStateConverter.java:91)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:43)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:29)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:426)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.getConnection
>> (ConnectionManager.java:144)
>>      [java]     at
>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>      [java]     at
>> org.hibernate.transaction.JDBCTransaction.begin
>> (JDBCTransaction.java:57)
>>      [java]     at
>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>      [java]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>      [java]     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>      [java]     at
>> org.hibernate.context.ThreadLocalSessionContext
>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>> 301)
>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>      [java]     at org.earthserve.model.EventManager.find(Unknown  
>> Source)
>>      [java]     at org.earthserve.model.EventManager.main(Unknown  
>> Source)
>>      [java] Caused by: org.postgresql.util.PSQLException: Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:462)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.<init>
>> (AbstractJdbc2Connection.java:136)
>>      [java]     at
>> org.postgresql.jdbc3.AbstractJdbc3Connection.<init>
>> (AbstractJdbc3Connection.java:30)
>>      [java]     at
>> org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
>>      [java]     at org.postgresql.Driver.makeConnection(Driver.java:
>> 369)
>>      [java]     at org.postgresql.Driver.connect(Driver.java:245)
>>      [java]     at org.postgis.DriverWrapper.connect
>> (DriverWrapper.java:155)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:525)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>      [java]     at
>> org.hibernate.connection.DriverManagerConnectionProvider.getConnection
>> (DriverManagerConnectionProvider.java:110)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:423)
>>      [java]     ... 12 more
>>      [java] Caused by: java.lang.ClassNotFoundException:  
>> org.postgis.PGbox3d
>>      [java]     at java.net.URLClassLoader$1.run
>> (URLClassLoader.java:200)
>>      [java]     at java.security.AccessController.doPrivileged(Native
>> Method)
>>      [java]     at
>> java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 316)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 251)
>>      [java]     at
>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
>>      [java]     at java.lang.Class.forName0(Native Method)
>>      [java]     at java.lang.Class.forName(Class.java:164)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:458)
>>      [java]     ... 22 more
>>      [java] Java Result: 1
>>
>> I looked in postgis.jar, and PGbox3d is in there.
>>
>> Here is the ant classpath:
>>
>>      [java] Executing
>> '/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/
>> bin/java'
>> with arguments:
>>      [java] '-classpath'
>>      [java]
>> '/Users/gregederer/dev/precip/lib/acme.jar:/Users/gregederer/dev/
>> precip/lib/activation.jar:/Users/gregederer/dev/precip/lib/
>> antlr-2.7.6.jar:/Users/gregederer/dev/precip/lib/asm-attrs.jar:/
>> Users/gregederer/dev/precip/lib/asm.jar:/Users/gregederer/dev/
>> precip/lib/c3p0-0.9.1.jar:/Users/gregederer/dev/precip/lib/
>> cglib-2.1.3.jar:/Users/gregederer/dev/precip/lib/commons-
>> beanutils.jar:/Users/gregederer/dev/precip/lib/commons-
>> collections-2.1.1.jar:/Users/gregederer/dev/precip/lib/commons-
>> logging-1.0.4.jar:/Users/gregederer/dev/precip/lib/commons-
>> net-1.4.1.jar:/Users/gregederer/dev/precip/lib/
>> concurrent-1.3.2.jar:/Users/gregederer/dev/precip/lib/
>> dom4j-1.6.1.jar:/Users/gregederer/dev/precip/lib/ehcache-1.2.3.jar:/
>> Users/gregederer/dev/precip/lib/hibernate-spatial-1.0-M1.jar:/Users/
>> gregederer/dev/precip/lib/hibernate-spatial-postgis-1.0-M1.jar:/
>> Users/gregederer/dev/precip/lib/hibernate3.jar:/Users/gregederer/
>> dev/precip/lib/jacc-1_0-fr.jar:/Users/gregederer/dev/precip/lib/
>> javacsv.jar:/Users/gregederer/dev/precip/lib/jaxen-1.1-beta-7.jar:/
>> Users/gregederer/dev/precip/lib/jdbc2_0-stdext.jar:/Users/
>> gregederer/dev/precip/lib/jdom.jar:/Users/gregederer/dev/precip/lib/
>> jta.jar:/Users/gregederer/dev/precip/lib/jts-1.8.jar:/Users/
>> gregederer/dev/precip/lib/jtsio-1.8.jar:/Users/gregederer/dev/
>> precip/lib/jxl.jar:/Users/gregederer/dev/precip/lib/
>> log4j-1.2.11.jar:/Users/gregederer/dev/precip/lib/postgis.jar:/
>> Users/gregederer/dev/precip/lib/postgresql-8.2-508.jdbc3.jar:/Users/
>> gregederer/dev/precip/lib/tar.jar:/Users/gregederer/dev/precip/lib/
>> xerces.jar:/Users/gregederer/dev/precip/lib/xml-apis.jar:/Users/
>> gregederer/dev/precip/bin'
>>
>> The postgis.jar is there, I see only one postgtresql JDBC driver jar.
>>
>> Again, thanks!  I think we're getting closer.
>>
>> Greg
>>
>> Karel Maesen wrote:
>>    
>>> I just checked. Using "jdbc:postgresql_POSTGIS" doesn't work on my
>>> system either.
>>>
>>> Is it possible that you have somewhere else a postgresql driver on
>>> the classpath (try running ant with the -verbose option)?
>>>
>>>
>>> On 06 Feb 2008, at 20:43, Greg Ederer wrote:
>>>
>>>
>>>      
>>>> Hi Karel,
>>>>
>>>> I see that ant reports:
>>>>
>>>>      [java] 11:08:22,256  INFO SettingsFactory:89 - RDBMS:  
>>>> PostgreSQL,
>>>> version: 8.2.5
>>>>      [java] 11:08:22,257  INFO SettingsFactory:90 - JDBC driver:
>>>> PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL
>>>> (build 407)
>>>>
>>>> which is odd because I'm using postgresql-8.2-508.jdbc3.jar.
>>>>
>>>> When I switched to jdbc:postgresql_postGIS://localhost:5432/testdb,
>>>> I got:
>>>>
>>>>      [java] 11:38:32,244  WARN JDBCExceptionReporter:77 - SQL
>>>> Error: 0,
>>>> SQLState: 08001
>>>>      [java] 11:38:32,245 ERROR JDBCExceptionReporter:78 - No
>>>> suitable driver
>>>>      [java] Exception in thread "main"
>>>> org.hibernate.exception.JDBCConnectionException: Cannot open
>>>> connection
>>>>      [java]     at
>>>> org.hibernate.exception.SQLStateConverter.convert
>>>> (SQLStateConverter.java:74)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:43)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:29)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:426)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.getConnection
>>>> (ConnectionManager.java:144)
>>>>      [java]     at
>>>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>>>      [java]     at
>>>> org.hibernate.transaction.JDBCTransaction.begin
>>>> (JDBCTransaction.java:57)
>>>>      [java]     at
>>>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:
>>>> 1326)
>>>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0
>>>> (Native
>>>> Method)
>>>>      [java]     at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>      [java]     at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>>>      [java]     at
>>>> org.hibernate.context.ThreadLocalSessionContext
>>>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>>>> 301)
>>>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>> Source)
>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>> Source)
>>>>      [java] Caused by: java.sql.SQLException: No suitable driver
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:545)
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>>>      [java]     at
>>>> org.hibernate.connection.DriverManagerConnectionProvider.getConnecti
>>>> on
>>>> (DriverManagerConnectionProvider.java:110)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:423)
>>>>      [java]     ... 12 more
>>>>      [java] Java Result: 1
>>>>
>>>> Cheers,
>>>>
>>>> Greg
>>>>
>>>> Karel Maesen wrote:
>>>>
>>>>        
>>>>> Hi Greg,
>>>>>
>>>>> The postgresql + postgis do not return PGgeometry (or Geometry)
>>>>> objects but "plain" PGobjects. Since postgis.jar is correctly
>>>>> installed, it seems that the postgresql jdbc driver fails to  
>>>>> register
>>>>> the postgis supplied geometry types. Could you check whether you  
>>>>> have
>>>>> a 8.0 or higher version of the postgresql JDBC driver?
>>>>>
>>>>> You might also try to change in the jdbc URL  "jdbc:postgresql"
>>>>> into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file).  
>>>>> This
>>>>> uses the postgis DriverWrapper which registers the geometry types
>>>>> explicitly.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Karel
>>>>>
>>>>>
>>>>> On 06 Feb 2008, at 20:16, gederer wrote:
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>> Hi Karel,
>>>>>>
>>>>>> Thanks for your reply. Here is the result of the query you  
>>>>>> sugested:
>>>>>>
>>>>>> testdb=# select title, astext(loc) from events;
>>>>>>   title   |    astext
>>>>>> ----------+--------------
>>>>>>  My Event | POINT(10 15)
>>>>>> (1 row)
>>>>>>
>>>>>> Also, I saw another post on this list where the 'Can't convert
>>>>>> object of
>>>>>> type org.postgresql.util.PGobject' occurred, and the problem was
>>>>>> solved by
>>>>>> placing postgis.jar on the classpath. I checked to be certain, and
>>>>>> I do have
>>>>>> this jar in my lib directory, and ant is able to find it.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Greg
>>>>>>
>>>>>>
>>>>>> gederer wrote:
>>>>>>
>>>>>>
>>>>>>            
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm working off of the tutorial at
>>>>>>> http://www.hibernatespatial.org/tutorial.html.  I have been able
>>>>>>> to load a
>>>>>>> point into the database via:
>>>>>>>
>>>>>>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>>>>>>
>>>>>>> But, when I run:
>>>>>>>
>>>>>>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1
>>>>>>> 1))"
>>>>>>>
>>>>>>> after modifying the main method and adding the find method, I get
>>>>>>> this
>>>>>>> output:
>>>>>>>
>>>>>>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>>>>>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>>>>>>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as
>>>>>>> title0_0_,
>>>>>>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>>>>>>> within(this_.LOC, ?))
>>>>>>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>>>>>>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,
>>>>>>> this_.LOC as
>>>>>>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>>>>>>> (this_.LOC,
>>>>>>> ?))
>>>>>>>      [java] Exception in thread "main"
>>>>>>> java.lang.IllegalArgumentException:
>>>>>>> Can't convert object of type org.postgresql.util.PGobject
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>>>>>>> (PGGeometryUserType.java:120)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>>>>>> (AbstractDBGeometryType.java:127)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.GeometryUserType.nullSafeGet
>>>>>>> (GeometryUserType.java:170)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>>>>>> (AbstractEntityPersister.java:2096)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:
>>>>>>> 1308)
>>>>>>>      [java]     at org.hibernate.loader.Loader.getRow
>>>>>>> (Loader.java:
>>>>>>> 1206)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doQuery
>>>>>>> (Loader.java:
>>>>>>> 701)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollection
>>>>>>> s
>>>>>>> (Loader.java:236)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doList
>>>>>>> (Loader.java:
>>>>>>> 2220)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:
>>>>>>> 2104)
>>>>>>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:
>>>>>>> 2099)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.criteria.CriteriaLoader.list
>>>>>>> (CriteriaLoader.java:94)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>>>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>>>>> Source)
>>>>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>>>>> Source)
>>>>>>>      [java] Java Result: 1
>>>>>>>
>>>>>>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from
>>>>>>> kyngchaos. Any
>>>>>>> suggestions?
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> Greg
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>> --
>>>>>> View this message in context: http://www.nabble.com/Can%27t- 
>>>>>> convert-
>>>>>> object-of-type-org.postgresql.util.PGobject-
>>>>>> tp15310652p15311498.html
>>>>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>>>>> Nabble.com.
>>>>>>
>>>>>> _______________________________________________
>>>>>> hibernatespatial-users mailing list
>>>>>> [hidden email]
>>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>>> hibernatespatial-users
>>>>>>
>>>>>>
>>>>>>            
>>>>> _______________________________________________
>>>>> hibernatespatial-users mailing list
>>>>> [hidden email]
>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>> hibernatespatial-users
>>>>>
>>>>>
>>>>>          
>>>> --
>>>> | E R G O N O S I S
>>>> | Greg Ederer
>>>> | Lead Developer
>>>> | [hidden email]
>>>> | 360.774.6848
>>>> |
>>>>
>>>> _______________________________________________
>>>> hibernatespatial-users mailing list
>>>> [hidden email]
>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>> hibernatespatial-users
>>>>
>>>>        
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>>> hibernatespatial-users
>>>
>>>      
>> --
>> | E R G O N O S I S
>> | Greg Ederer
>> | Lead Developer
>> | [hidden email]
>> | 360.774.6848
>> |
>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>    
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>  


--
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| [hidden email]
| 360.774.6848
|

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
Greg Ederer

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Karel Maesen
I also created a simple test class:

package org.earthserve.model;

import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;

import org.postgis.PGgeometry;

public class JavaGIS
{

    public static void main(String[] args)
    {

        java.sql.Connection conn;

        try
        {
            /*
             * Load the JDBC driver and establish a connection.
             */
            Class.forName("org.postgresql.Driver");
            String url = "jdbc:postgresql://localhost:5432/testdb";
            conn = DriverManager.getConnection(url, "postgres", "");
            /*
             * Add the geometry types to the connection. Note that you
must cast the
             * connection to the pgsql-specific connection
implementation before
             * calling the addDataType() method.
             */
            ((org.postgresql.PGConnection) conn).addDataType("geometry",
org.postgis.PGgeometry.class);
            ((org.postgresql.PGConnection) conn).addDataType("box3d",
org.postgis.PGbox3d.class);
            /*
             * Create a statement and execute a select query.
             */
            Statement s = conn.createStatement();
            ResultSet r = s.executeQuery("select loc, event_id from
events");
            while (r.next())
            {
                /*
                 * Retrieve the geometry as an object then cast it to
the geometry type.
                 * Print things out.
                 */
                PGgeometry geom = (PGgeometry) r.getObject(1);
                int id = r.getInt(2);
                System.out.println("Row " + id + ":");
                System.out.println(geom.toString());
            }
            s.close();
            conn.close();
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }
}

This works.  However, when I use the deprecated method:

((org.postgresql.PGConnection) conn).addDataType("geometry",
"org.postgis.PGgeometry");

I get the same ClassNotFoundException.  Is it possible that when I use
Hibernate Spatial this deprecated method is being called somewhere in my
stack?  I'm not sure where this would occur.

Thanks!

Greg

Karel Maesen wrote:

> With driver class property changed, the DriverWrapper now works on my  
> side. (And I'm also on an OS X system)
>
> Clearly the problem is that the Postgis extension types fail to load  
> in the postgresql driver for some reason. So this looks like a  
> postgresql/postgis problem. I would try with slightly older versions  
> of the postgis and postgresql-jdbc jars.
>
> If none of that works, I should try to write a simple JDBC/Postgis  
> program and see if you have the same type of problem there (check the  
> postgis documentation for examples). If so, you could also ask for  
> help on the postgis mailing list.
>
> On 06 Feb 2008, at 21:30, Greg Ederer wrote:
>
>  
>> Hi Karel,
>>
>> I saw somewhere that the driver class also has to be changed.  So,  
>> with
>> this in my build.xml:
>>
>>         <property
>> name="connection.driver_class">org.postgis.DriverWrapper</property>
>>         <property
>> name="connection.url">jdbc:postgresql_postGIS://localhost:5432/
>> testdb</property>
>>
>> I get:
>>
>>      [java] 12:14:35,412  WARN JDBCExceptionReporter:77 - SQL  
>> Error: 0,
>> SQLState: 60000
>>      [java] 12:14:35,412 ERROR JDBCExceptionReporter:78 - Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java] Exception in thread "main"
>> org.hibernate.exception.GenericJDBCException: Cannot open connection
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.handledNonSpecificException(
>> SQLStateConverter.java:103)
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.convert
>> (SQLStateConverter.java:91)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:43)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:29)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:426)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.getConnection
>> (ConnectionManager.java:144)
>>      [java]     at
>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>      [java]     at
>> org.hibernate.transaction.JDBCTransaction.begin
>> (JDBCTransaction.java:57)
>>      [java]     at
>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>      [java]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>      [java]     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>      [java]     at
>> org.hibernate.context.ThreadLocalSessionContext
>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>> 301)
>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>      [java]     at org.earthserve.model.EventManager.find(Unknown  
>> Source)
>>      [java]     at org.earthserve.model.EventManager.main(Unknown  
>> Source)
>>      [java] Caused by: org.postgresql.util.PSQLException: Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:462)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.<init>
>> (AbstractJdbc2Connection.java:136)
>>      [java]     at
>> org.postgresql.jdbc3.AbstractJdbc3Connection.<init>
>> (AbstractJdbc3Connection.java:30)
>>      [java]     at
>> org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
>>      [java]     at org.postgresql.Driver.makeConnection(Driver.java:
>> 369)
>>      [java]     at org.postgresql.Driver.connect(Driver.java:245)
>>      [java]     at org.postgis.DriverWrapper.connect
>> (DriverWrapper.java:155)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:525)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>      [java]     at
>> org.hibernate.connection.DriverManagerConnectionProvider.getConnection
>> (DriverManagerConnectionProvider.java:110)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:423)
>>      [java]     ... 12 more
>>      [java] Caused by: java.lang.ClassNotFoundException:  
>> org.postgis.PGbox3d
>>      [java]     at java.net.URLClassLoader$1.run
>> (URLClassLoader.java:200)
>>      [java]     at java.security.AccessController.doPrivileged(Native
>> Method)
>>      [java]     at
>> java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 316)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 251)
>>      [java]     at
>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
>>      [java]     at java.lang.Class.forName0(Native Method)
>>      [java]     at java.lang.Class.forName(Class.java:164)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:458)
>>      [java]     ... 22 more
>>      [java] Java Result: 1
>>
>> I looked in postgis.jar, and PGbox3d is in there.
>>
>> Here is the ant classpath:
>>
>>      [java] Executing
>> '/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/
>> bin/java'
>> with arguments:
>>      [java] '-classpath'
>>      [java]
>> '/Users/gregederer/dev/precip/lib/acme.jar:/Users/gregederer/dev/
>> precip/lib/activation.jar:/Users/gregederer/dev/precip/lib/
>> antlr-2.7.6.jar:/Users/gregederer/dev/precip/lib/asm-attrs.jar:/
>> Users/gregederer/dev/precip/lib/asm.jar:/Users/gregederer/dev/
>> precip/lib/c3p0-0.9.1.jar:/Users/gregederer/dev/precip/lib/
>> cglib-2.1.3.jar:/Users/gregederer/dev/precip/lib/commons-
>> beanutils.jar:/Users/gregederer/dev/precip/lib/commons-
>> collections-2.1.1.jar:/Users/gregederer/dev/precip/lib/commons-
>> logging-1.0.4.jar:/Users/gregederer/dev/precip/lib/commons-
>> net-1.4.1.jar:/Users/gregederer/dev/precip/lib/
>> concurrent-1.3.2.jar:/Users/gregederer/dev/precip/lib/
>> dom4j-1.6.1.jar:/Users/gregederer/dev/precip/lib/ehcache-1.2.3.jar:/
>> Users/gregederer/dev/precip/lib/hibernate-spatial-1.0-M1.jar:/Users/
>> gregederer/dev/precip/lib/hibernate-spatial-postgis-1.0-M1.jar:/
>> Users/gregederer/dev/precip/lib/hibernate3.jar:/Users/gregederer/
>> dev/precip/lib/jacc-1_0-fr.jar:/Users/gregederer/dev/precip/lib/
>> javacsv.jar:/Users/gregederer/dev/precip/lib/jaxen-1.1-beta-7.jar:/
>> Users/gregederer/dev/precip/lib/jdbc2_0-stdext.jar:/Users/
>> gregederer/dev/precip/lib/jdom.jar:/Users/gregederer/dev/precip/lib/
>> jta.jar:/Users/gregederer/dev/precip/lib/jts-1.8.jar:/Users/
>> gregederer/dev/precip/lib/jtsio-1.8.jar:/Users/gregederer/dev/
>> precip/lib/jxl.jar:/Users/gregederer/dev/precip/lib/
>> log4j-1.2.11.jar:/Users/gregederer/dev/precip/lib/postgis.jar:/
>> Users/gregederer/dev/precip/lib/postgresql-8.2-508.jdbc3.jar:/Users/
>> gregederer/dev/precip/lib/tar.jar:/Users/gregederer/dev/precip/lib/
>> xerces.jar:/Users/gregederer/dev/precip/lib/xml-apis.jar:/Users/
>> gregederer/dev/precip/bin'
>>
>> The postgis.jar is there, I see only one postgtresql JDBC driver jar.
>>
>> Again, thanks!  I think we're getting closer.
>>
>> Greg
>>
>> Karel Maesen wrote:
>>    
>>> I just checked. Using "jdbc:postgresql_POSTGIS" doesn't work on my
>>> system either.
>>>
>>> Is it possible that you have somewhere else a postgresql driver on
>>> the classpath (try running ant with the -verbose option)?
>>>
>>>
>>> On 06 Feb 2008, at 20:43, Greg Ederer wrote:
>>>
>>>
>>>      
>>>> Hi Karel,
>>>>
>>>> I see that ant reports:
>>>>
>>>>      [java] 11:08:22,256  INFO SettingsFactory:89 - RDBMS:  
>>>> PostgreSQL,
>>>> version: 8.2.5
>>>>      [java] 11:08:22,257  INFO SettingsFactory:90 - JDBC driver:
>>>> PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL
>>>> (build 407)
>>>>
>>>> which is odd because I'm using postgresql-8.2-508.jdbc3.jar.
>>>>
>>>> When I switched to jdbc:postgresql_postGIS://localhost:5432/testdb,
>>>> I got:
>>>>
>>>>      [java] 11:38:32,244  WARN JDBCExceptionReporter:77 - SQL
>>>> Error: 0,
>>>> SQLState: 08001
>>>>      [java] 11:38:32,245 ERROR JDBCExceptionReporter:78 - No
>>>> suitable driver
>>>>      [java] Exception in thread "main"
>>>> org.hibernate.exception.JDBCConnectionException: Cannot open
>>>> connection
>>>>      [java]     at
>>>> org.hibernate.exception.SQLStateConverter.convert
>>>> (SQLStateConverter.java:74)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:43)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:29)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:426)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.getConnection
>>>> (ConnectionManager.java:144)
>>>>      [java]     at
>>>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>>>      [java]     at
>>>> org.hibernate.transaction.JDBCTransaction.begin
>>>> (JDBCTransaction.java:57)
>>>>      [java]     at
>>>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:
>>>> 1326)
>>>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0
>>>> (Native
>>>> Method)
>>>>      [java]     at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>      [java]     at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>>>      [java]     at
>>>> org.hibernate.context.ThreadLocalSessionContext
>>>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>>>> 301)
>>>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>> Source)
>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>> Source)
>>>>      [java] Caused by: java.sql.SQLException: No suitable driver
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:545)
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>>>      [java]     at
>>>> org.hibernate.connection.DriverManagerConnectionProvider.getConnecti
>>>> on
>>>> (DriverManagerConnectionProvider.java:110)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:423)
>>>>      [java]     ... 12 more
>>>>      [java] Java Result: 1
>>>>
>>>> Cheers,
>>>>
>>>> Greg
>>>>
>>>> Karel Maesen wrote:
>>>>
>>>>        
>>>>> Hi Greg,
>>>>>
>>>>> The postgresql + postgis do not return PGgeometry (or Geometry)
>>>>> objects but "plain" PGobjects. Since postgis.jar is correctly
>>>>> installed, it seems that the postgresql jdbc driver fails to  
>>>>> register
>>>>> the postgis supplied geometry types. Could you check whether you  
>>>>> have
>>>>> a 8.0 or higher version of the postgresql JDBC driver?
>>>>>
>>>>> You might also try to change in the jdbc URL  "jdbc:postgresql"
>>>>> into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file).  
>>>>> This
>>>>> uses the postgis DriverWrapper which registers the geometry types
>>>>> explicitly.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Karel
>>>>>
>>>>>
>>>>> On 06 Feb 2008, at 20:16, gederer wrote:
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>> Hi Karel,
>>>>>>
>>>>>> Thanks for your reply. Here is the result of the query you  
>>>>>> sugested:
>>>>>>
>>>>>> testdb=# select title, astext(loc) from events;
>>>>>>   title   |    astext
>>>>>> ----------+--------------
>>>>>>  My Event | POINT(10 15)
>>>>>> (1 row)
>>>>>>
>>>>>> Also, I saw another post on this list where the 'Can't convert
>>>>>> object of
>>>>>> type org.postgresql.util.PGobject' occurred, and the problem was
>>>>>> solved by
>>>>>> placing postgis.jar on the classpath. I checked to be certain, and
>>>>>> I do have
>>>>>> this jar in my lib directory, and ant is able to find it.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Greg
>>>>>>
>>>>>>
>>>>>> gederer wrote:
>>>>>>
>>>>>>
>>>>>>            
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm working off of the tutorial at
>>>>>>> http://www.hibernatespatial.org/tutorial.html.  I have been able
>>>>>>> to load a
>>>>>>> point into the database via:
>>>>>>>
>>>>>>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>>>>>>
>>>>>>> But, when I run:
>>>>>>>
>>>>>>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1
>>>>>>> 1))"
>>>>>>>
>>>>>>> after modifying the main method and adding the find method, I get
>>>>>>> this
>>>>>>> output:
>>>>>>>
>>>>>>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>>>>>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>>>>>>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as
>>>>>>> title0_0_,
>>>>>>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>>>>>>> within(this_.LOC, ?))
>>>>>>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>>>>>>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,
>>>>>>> this_.LOC as
>>>>>>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>>>>>>> (this_.LOC,
>>>>>>> ?))
>>>>>>>      [java] Exception in thread "main"
>>>>>>> java.lang.IllegalArgumentException:
>>>>>>> Can't convert object of type org.postgresql.util.PGobject
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>>>>>>> (PGGeometryUserType.java:120)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>>>>>> (AbstractDBGeometryType.java:127)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.GeometryUserType.nullSafeGet
>>>>>>> (GeometryUserType.java:170)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>>>>>> (AbstractEntityPersister.java:2096)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:
>>>>>>> 1308)
>>>>>>>      [java]     at org.hibernate.loader.Loader.getRow
>>>>>>> (Loader.java:
>>>>>>> 1206)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doQuery
>>>>>>> (Loader.java:
>>>>>>> 701)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollection
>>>>>>> s
>>>>>>> (Loader.java:236)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doList
>>>>>>> (Loader.java:
>>>>>>> 2220)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:
>>>>>>> 2104)
>>>>>>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:
>>>>>>> 2099)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.criteria.CriteriaLoader.list
>>>>>>> (CriteriaLoader.java:94)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>>>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>>>>> Source)
>>>>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>>>>> Source)
>>>>>>>      [java] Java Result: 1
>>>>>>>
>>>>>>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from
>>>>>>> kyngchaos. Any
>>>>>>> suggestions?
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> Greg
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>> --
>>>>>> View this message in context: http://www.nabble.com/Can%27t- 
>>>>>> convert-
>>>>>> object-of-type-org.postgresql.util.PGobject-
>>>>>> tp15310652p15311498.html
>>>>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>>>>> Nabble.com.
>>>>>>
>>>>>> _______________________________________________
>>>>>> hibernatespatial-users mailing list
>>>>>> [hidden email]
>>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>>> hibernatespatial-users
>>>>>>
>>>>>>
>>>>>>            
>>>>> _______________________________________________
>>>>> hibernatespatial-users mailing list
>>>>> [hidden email]
>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>> hibernatespatial-users
>>>>>
>>>>>
>>>>>          
>>>> --
>>>> | E R G O N O S I S
>>>> | Greg Ederer
>>>> | Lead Developer
>>>> | [hidden email]
>>>> | 360.774.6848
>>>> |
>>>>
>>>> _______________________________________________
>>>> hibernatespatial-users mailing list
>>>> [hidden email]
>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>> hibernatespatial-users
>>>>
>>>>        
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> [hidden email]
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>>> hibernatespatial-users
>>>
>>>      
>> --
>> | E R G O N O S I S
>> | Greg Ederer
>> | Lead Developer
>> | [hidden email]
>> | 360.774.6848
>> |
>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>    
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>  


--
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| [hidden email]
| 360.774.6848
|

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
matbal

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Greg Ederer
I'm sure you already solved the problem, Greg. Just for your information: I built the postgis-jar myself too and I experienced the same problem. Trying to find a solution I downloaded the JDBC snapshot from http://postgis.refractions.net/download/ and now it works like a charm.

Cheers,
Mat

gederer wrote:
Hi Karel,

Thank you so much for all your help.  I'll try your suggestions.

Cheers,

Greg

Karel Maesen wrote:
> With driver class property changed, the DriverWrapper now works on my  
> side. (And I'm also on an OS X system)
>
> Clearly the problem is that the Postgis extension types fail to load  
> in the postgresql driver for some reason. So this looks like a  
> postgresql/postgis problem. I would try with slightly older versions  
> of the postgis and postgresql-jdbc jars.
>
> If none of that works, I should try to write a simple JDBC/Postgis  
> program and see if you have the same type of problem there (check the  
> postgis documentation for examples). If so, you could also ask for  
> help on the postgis mailing list.
>
> On 06 Feb 2008, at 21:30, Greg Ederer wrote:
>
>  
>> Hi Karel,
>>
>> I saw somewhere that the driver class also has to be changed.  So,  
>> with
>> this in my build.xml:
>>
>>         <property
>> name="connection.driver_class">org.postgis.DriverWrapper</property>
>>         <property
>> name="connection.url">jdbc:postgresql_postGIS://localhost:5432/
>> testdb</property>
>>
>> I get:
>>
>>      [java] 12:14:35,412  WARN JDBCExceptionReporter:77 - SQL  
>> Error: 0,
>> SQLState: 60000
>>      [java] 12:14:35,412 ERROR JDBCExceptionReporter:78 - Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java] Exception in thread "main"
>> org.hibernate.exception.GenericJDBCException: Cannot open connection
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.handledNonSpecificException(
>> SQLStateConverter.java:103)
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.convert
>> (SQLStateConverter.java:91)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:43)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:29)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:426)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.getConnection
>> (ConnectionManager.java:144)
>>      [java]     at
>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>      [java]     at
>> org.hibernate.transaction.JDBCTransaction.begin
>> (JDBCTransaction.java:57)
>>      [java]     at
>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>      [java]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>      [java]     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>      [java]     at
>> org.hibernate.context.ThreadLocalSessionContext
>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>> 301)
>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>      [java]     at org.earthserve.model.EventManager.find(Unknown  
>> Source)
>>      [java]     at org.earthserve.model.EventManager.main(Unknown  
>> Source)
>>      [java] Caused by: org.postgresql.util.PSQLException: Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:462)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.<init>
>> (AbstractJdbc2Connection.java:136)
>>      [java]     at
>> org.postgresql.jdbc3.AbstractJdbc3Connection.<init>
>> (AbstractJdbc3Connection.java:30)
>>      [java]     at
>> org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
>>      [java]     at org.postgresql.Driver.makeConnection(Driver.java:
>> 369)
>>      [java]     at org.postgresql.Driver.connect(Driver.java:245)
>>      [java]     at org.postgis.DriverWrapper.connect
>> (DriverWrapper.java:155)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:525)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>      [java]     at
>> org.hibernate.connection.DriverManagerConnectionProvider.getConnection
>> (DriverManagerConnectionProvider.java:110)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:423)
>>      [java]     ... 12 more
>>      [java] Caused by: java.lang.ClassNotFoundException:  
>> org.postgis.PGbox3d
>>      [java]     at java.net.URLClassLoader$1.run
>> (URLClassLoader.java:200)
>>      [java]     at java.security.AccessController.doPrivileged(Native
>> Method)
>>      [java]     at
>> java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 316)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 251)
>>      [java]     at
>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
>>      [java]     at java.lang.Class.forName0(Native Method)
>>      [java]     at java.lang.Class.forName(Class.java:164)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:458)
>>      [java]     ... 22 more
>>      [java] Java Result: 1
>>
>> I looked in postgis.jar, and PGbox3d is in there.
>>
>> Here is the ant classpath:
>>
>>      [java] Executing
>> '/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/
>> bin/java'
>> with arguments:
>>      [java] '-classpath'
>>      [java]
>> '/Users/gregederer/dev/precip/lib/acme.jar:/Users/gregederer/dev/
>> precip/lib/activation.jar:/Users/gregederer/dev/precip/lib/
>> antlr-2.7.6.jar:/Users/gregederer/dev/precip/lib/asm-attrs.jar:/
>> Users/gregederer/dev/precip/lib/asm.jar:/Users/gregederer/dev/
>> precip/lib/c3p0-0.9.1.jar:/Users/gregederer/dev/precip/lib/
>> cglib-2.1.3.jar:/Users/gregederer/dev/precip/lib/commons-
>> beanutils.jar:/Users/gregederer/dev/precip/lib/commons-
>> collections-2.1.1.jar:/Users/gregederer/dev/precip/lib/commons-
>> logging-1.0.4.jar:/Users/gregederer/dev/precip/lib/commons-
>> net-1.4.1.jar:/Users/gregederer/dev/precip/lib/
>> concurrent-1.3.2.jar:/Users/gregederer/dev/precip/lib/
>> dom4j-1.6.1.jar:/Users/gregederer/dev/precip/lib/ehcache-1.2.3.jar:/
>> Users/gregederer/dev/precip/lib/hibernate-spatial-1.0-M1.jar:/Users/
>> gregederer/dev/precip/lib/hibernate-spatial-postgis-1.0-M1.jar:/
>> Users/gregederer/dev/precip/lib/hibernate3.jar:/Users/gregederer/
>> dev/precip/lib/jacc-1_0-fr.jar:/Users/gregederer/dev/precip/lib/
>> javacsv.jar:/Users/gregederer/dev/precip/lib/jaxen-1.1-beta-7.jar:/
>> Users/gregederer/dev/precip/lib/jdbc2_0-stdext.jar:/Users/
>> gregederer/dev/precip/lib/jdom.jar:/Users/gregederer/dev/precip/lib/
>> jta.jar:/Users/gregederer/dev/precip/lib/jts-1.8.jar:/Users/
>> gregederer/dev/precip/lib/jtsio-1.8.jar:/Users/gregederer/dev/
>> precip/lib/jxl.jar:/Users/gregederer/dev/precip/lib/
>> log4j-1.2.11.jar:/Users/gregederer/dev/precip/lib/postgis.jar:/
>> Users/gregederer/dev/precip/lib/postgresql-8.2-508.jdbc3.jar:/Users/
>> gregederer/dev/precip/lib/tar.jar:/Users/gregederer/dev/precip/lib/
>> xerces.jar:/Users/gregederer/dev/precip/lib/xml-apis.jar:/Users/
>> gregederer/dev/precip/bin'
>>
>> The postgis.jar is there, I see only one postgtresql JDBC driver jar.
>>
>> Again, thanks!  I think we're getting closer.
>>
>> Greg
>>
>> Karel Maesen wrote:
>>    
>>> I just checked. Using "jdbc:postgresql_POSTGIS" doesn't work on my
>>> system either.
>>>
>>> Is it possible that you have somewhere else a postgresql driver on
>>> the classpath (try running ant with the -verbose option)?
>>>
>>>
>>> On 06 Feb 2008, at 20:43, Greg Ederer wrote:
>>>
>>>
>>>      
>>>> Hi Karel,
>>>>
>>>> I see that ant reports:
>>>>
>>>>      [java] 11:08:22,256  INFO SettingsFactory:89 - RDBMS:  
>>>> PostgreSQL,
>>>> version: 8.2.5
>>>>      [java] 11:08:22,257  INFO SettingsFactory:90 - JDBC driver:
>>>> PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL
>>>> (build 407)
>>>>
>>>> which is odd because I'm using postgresql-8.2-508.jdbc3.jar.
>>>>
>>>> When I switched to jdbc:postgresql_postGIS://localhost:5432/testdb,
>>>> I got:
>>>>
>>>>      [java] 11:38:32,244  WARN JDBCExceptionReporter:77 - SQL
>>>> Error: 0,
>>>> SQLState: 08001
>>>>      [java] 11:38:32,245 ERROR JDBCExceptionReporter:78 - No
>>>> suitable driver
>>>>      [java] Exception in thread "main"
>>>> org.hibernate.exception.JDBCConnectionException: Cannot open
>>>> connection
>>>>      [java]     at
>>>> org.hibernate.exception.SQLStateConverter.convert
>>>> (SQLStateConverter.java:74)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:43)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:29)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:426)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.getConnection
>>>> (ConnectionManager.java:144)
>>>>      [java]     at
>>>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>>>      [java]     at
>>>> org.hibernate.transaction.JDBCTransaction.begin
>>>> (JDBCTransaction.java:57)
>>>>      [java]     at
>>>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:
>>>> 1326)
>>>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0
>>>> (Native
>>>> Method)
>>>>      [java]     at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>      [java]     at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>>>      [java]     at
>>>> org.hibernate.context.ThreadLocalSessionContext
>>>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>>>> 301)
>>>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>> Source)
>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>> Source)
>>>>      [java] Caused by: java.sql.SQLException: No suitable driver
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:545)
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>>>      [java]     at
>>>> org.hibernate.connection.DriverManagerConnectionProvider.getConnecti
>>>> on
>>>> (DriverManagerConnectionProvider.java:110)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:423)
>>>>      [java]     ... 12 more
>>>>      [java] Java Result: 1
>>>>
>>>> Cheers,
>>>>
>>>> Greg
>>>>
>>>> Karel Maesen wrote:
>>>>
>>>>        
>>>>> Hi Greg,
>>>>>
>>>>> The postgresql + postgis do not return PGgeometry (or Geometry)
>>>>> objects but "plain" PGobjects. Since postgis.jar is correctly
>>>>> installed, it seems that the postgresql jdbc driver fails to  
>>>>> register
>>>>> the postgis supplied geometry types. Could you check whether you  
>>>>> have
>>>>> a 8.0 or higher version of the postgresql JDBC driver?
>>>>>
>>>>> You might also try to change in the jdbc URL  "jdbc:postgresql"
>>>>> into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file).  
>>>>> This
>>>>> uses the postgis DriverWrapper which registers the geometry types
>>>>> explicitly.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Karel
>>>>>
>>>>>
>>>>> On 06 Feb 2008, at 20:16, gederer wrote:
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>> Hi Karel,
>>>>>>
>>>>>> Thanks for your reply. Here is the result of the query you  
>>>>>> sugested:
>>>>>>
>>>>>> testdb=# select title, astext(loc) from events;
>>>>>>   title   |    astext
>>>>>> ----------+--------------
>>>>>>  My Event | POINT(10 15)
>>>>>> (1 row)
>>>>>>
>>>>>> Also, I saw another post on this list where the 'Can't convert
>>>>>> object of
>>>>>> type org.postgresql.util.PGobject' occurred, and the problem was
>>>>>> solved by
>>>>>> placing postgis.jar on the classpath. I checked to be certain, and
>>>>>> I do have
>>>>>> this jar in my lib directory, and ant is able to find it.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Greg
>>>>>>
>>>>>>
>>>>>> gederer wrote:
>>>>>>
>>>>>>
>>>>>>            
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm working off of the tutorial at
>>>>>>> http://www.hibernatespatial.org/tutorial.html.  I have been able
>>>>>>> to load a
>>>>>>> point into the database via:
>>>>>>>
>>>>>>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>>>>>>
>>>>>>> But, when I run:
>>>>>>>
>>>>>>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1
>>>>>>> 1))"
>>>>>>>
>>>>>>> after modifying the main method and adding the find method, I get
>>>>>>> this
>>>>>>> output:
>>>>>>>
>>>>>>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>>>>>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>>>>>>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as
>>>>>>> title0_0_,
>>>>>>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>>>>>>> within(this_.LOC, ?))
>>>>>>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>>>>>>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,
>>>>>>> this_.LOC as
>>>>>>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>>>>>>> (this_.LOC,
>>>>>>> ?))
>>>>>>>      [java] Exception in thread "main"
>>>>>>> java.lang.IllegalArgumentException:
>>>>>>> Can't convert object of type org.postgresql.util.PGobject
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>>>>>>> (PGGeometryUserType.java:120)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>>>>>> (AbstractDBGeometryType.java:127)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.GeometryUserType.nullSafeGet
>>>>>>> (GeometryUserType.java:170)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>>>>>> (AbstractEntityPersister.java:2096)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:
>>>>>>> 1308)
>>>>>>>      [java]     at org.hibernate.loader.Loader.getRow
>>>>>>> (Loader.java:
>>>>>>> 1206)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doQuery
>>>>>>> (Loader.java:
>>>>>>> 701)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollection
>>>>>>> s
>>>>>>> (Loader.java:236)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doList
>>>>>>> (Loader.java:
>>>>>>> 2220)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:
>>>>>>> 2104)
>>>>>>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:
>>>>>>> 2099)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.criteria.CriteriaLoader.list
>>>>>>> (CriteriaLoader.java:94)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>>>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>>>>> Source)
>>>>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>>>>> Source)
>>>>>>>      [java] Java Result: 1
>>>>>>>
>>>>>>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from
>>>>>>> kyngchaos. Any
>>>>>>> suggestions?
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> Greg
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>> --
>>>>>> View this message in context: http://www.nabble.com/Can%27t- 
>>>>>> convert-
>>>>>> object-of-type-org.postgresql.util.PGobject-
>>>>>> tp15310652p15311498.html
>>>>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>>>>> Nabble.com.
>>>>>>
>>>>>> _______________________________________________
>>>>>> hibernatespatial-users mailing list
>>>>>> hibernatespatial-users@lists.hibernatespatial.org
>>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>>> hibernatespatial-users
>>>>>>
>>>>>>
>>>>>>            
>>>>> _______________________________________________
>>>>> hibernatespatial-users mailing list
>>>>> hibernatespatial-users@lists.hibernatespatial.org
>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>> hibernatespatial-users
>>>>>
>>>>>
>>>>>          
>>>> --
>>>> | E R G O N O S I S
>>>> | Greg Ederer
>>>> | Lead Developer
>>>> | greg@ergonosis.com
>>>> | 360.774.6848
>>>> |
>>>>
>>>> _______________________________________________
>>>> hibernatespatial-users mailing list
>>>> hibernatespatial-users@lists.hibernatespatial.org
>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>> hibernatespatial-users
>>>>
>>>>        
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> hibernatespatial-users@lists.hibernatespatial.org
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>>> hibernatespatial-users
>>>
>>>      
>> --
>> | E R G O N O S I S
>> | Greg Ederer
>> | Lead Developer
>> | greg@ergonosis.com
>> | 360.774.6848
>> |
>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> hibernatespatial-users@lists.hibernatespatial.org
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>    
>
> _______________________________________________
> hibernatespatial-users mailing list
> hibernatespatial-users@lists.hibernatespatial.org
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>  


--
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| greg@ergonosis.com
| 360.774.6848
|

_______________________________________________
hibernatespatial-users mailing list
hibernatespatial-users@lists.hibernatespatial.org
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
jbella

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

Reply Threaded More More options
Print post
Permalink
hmm.

I have tried all the suggestions on this thread, and I am still having the problem.
I installed the Postgres/GIS installation from Kyng Chaos on a Mac as well. Could this be the root of the problem?

matbal wrote:
I'm sure you already solved the problem, Greg. Just for your information: I built the postgis-jar myself too and I experienced the same problem. Trying to find a solution I downloaded the JDBC snapshot from http://postgis.refractions.net/download/ and now it works like a charm.

Cheers,
Mat

gederer wrote:
Hi Karel,

Thank you so much for all your help.  I'll try your suggestions.

Cheers,

Greg

Karel Maesen wrote:
> With driver class property changed, the DriverWrapper now works on my  
> side. (And I'm also on an OS X system)
>
> Clearly the problem is that the Postgis extension types fail to load  
> in the postgresql driver for some reason. So this looks like a  
> postgresql/postgis problem. I would try with slightly older versions  
> of the postgis and postgresql-jdbc jars.
>
> If none of that works, I should try to write a simple JDBC/Postgis  
> program and see if you have the same type of problem there (check the  
> postgis documentation for examples). If so, you could also ask for  
> help on the postgis mailing list.
>
> On 06 Feb 2008, at 21:30, Greg Ederer wrote:
>
>  
>> Hi Karel,
>>
>> I saw somewhere that the driver class also has to be changed.  So,  
>> with
>> this in my build.xml:
>>
>>         <property
>> name="connection.driver_class">org.postgis.DriverWrapper</property>
>>         <property
>> name="connection.url">jdbc:postgresql_postGIS://localhost:5432/
>> testdb</property>
>>
>> I get:
>>
>>      [java] 12:14:35,412  WARN JDBCExceptionReporter:77 - SQL  
>> Error: 0,
>> SQLState: 60000
>>      [java] 12:14:35,412 ERROR JDBCExceptionReporter:78 - Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java] Exception in thread "main"
>> org.hibernate.exception.GenericJDBCException: Cannot open connection
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.handledNonSpecificException(
>> SQLStateConverter.java:103)
>>      [java]     at
>> org.hibernate.exception.SQLStateConverter.convert
>> (SQLStateConverter.java:91)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:43)
>>      [java]     at
>> org.hibernate.exception.JDBCExceptionHelper.convert
>> (JDBCExceptionHelper.java:29)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:426)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.getConnection
>> (ConnectionManager.java:144)
>>      [java]     at
>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>      [java]     at
>> org.hibernate.transaction.JDBCTransaction.begin
>> (JDBCTransaction.java:57)
>>      [java]     at
>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:1326)
>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0(Native
>> Method)
>>      [java]     at
>> sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>>      [java]     at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>      [java]     at
>> org.hibernate.context.ThreadLocalSessionContext
>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>> 301)
>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>      [java]     at org.earthserve.model.EventManager.find(Unknown  
>> Source)
>>      [java]     at org.earthserve.model.EventManager.main(Unknown  
>> Source)
>>      [java] Caused by: org.postgresql.util.PSQLException: Unable to  
>> load
>> the class org.postgis.PGbox3d responsible for the datatype box3d
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:462)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.<init>
>> (AbstractJdbc2Connection.java:136)
>>      [java]     at
>> org.postgresql.jdbc3.AbstractJdbc3Connection.<init>
>> (AbstractJdbc3Connection.java:30)
>>      [java]     at
>> org.postgresql.jdbc3.Jdbc3Connection.<init>(Jdbc3Connection.java:24)
>>      [java]     at org.postgresql.Driver.makeConnection(Driver.java:
>> 369)
>>      [java]     at org.postgresql.Driver.connect(Driver.java:245)
>>      [java]     at org.postgis.DriverWrapper.connect
>> (DriverWrapper.java:155)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:525)
>>      [java]     at
>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>      [java]     at
>> org.hibernate.connection.DriverManagerConnectionProvider.getConnection
>> (DriverManagerConnectionProvider.java:110)
>>      [java]     at
>> org.hibernate.jdbc.ConnectionManager.openConnection
>> (ConnectionManager.java:423)
>>      [java]     ... 12 more
>>      [java] Caused by: java.lang.ClassNotFoundException:  
>> org.postgis.PGbox3d
>>      [java]     at java.net.URLClassLoader$1.run
>> (URLClassLoader.java:200)
>>      [java]     at java.security.AccessController.doPrivileged(Native
>> Method)
>>      [java]     at
>> java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 316)
>>      [java]     at java.lang.ClassLoader.loadClass(ClassLoader.java:
>> 251)
>>      [java]     at
>> java.lang.ClassLoader.loadClassInternal(ClassLoader.java:374)
>>      [java]     at java.lang.Class.forName0(Native Method)
>>      [java]     at java.lang.Class.forName(Class.java:164)
>>      [java]     at
>> org.postgresql.jdbc2.AbstractJdbc2Connection.initObjectTypes
>> (AbstractJdbc2Connection.java:458)
>>      [java]     ... 22 more
>>      [java] Java Result: 1
>>
>> I looked in postgis.jar, and PGbox3d is in there.
>>
>> Here is the ant classpath:
>>
>>      [java] Executing
>> '/System/Library/Frameworks/JavaVM.framework/Versions/1.5.0/Home/
>> bin/java'
>> with arguments:
>>      [java] '-classpath'
>>      [java]
>> '/Users/gregederer/dev/precip/lib/acme.jar:/Users/gregederer/dev/
>> precip/lib/activation.jar:/Users/gregederer/dev/precip/lib/
>> antlr-2.7.6.jar:/Users/gregederer/dev/precip/lib/asm-attrs.jar:/
>> Users/gregederer/dev/precip/lib/asm.jar:/Users/gregederer/dev/
>> precip/lib/c3p0-0.9.1.jar:/Users/gregederer/dev/precip/lib/
>> cglib-2.1.3.jar:/Users/gregederer/dev/precip/lib/commons-
>> beanutils.jar:/Users/gregederer/dev/precip/lib/commons-
>> collections-2.1.1.jar:/Users/gregederer/dev/precip/lib/commons-
>> logging-1.0.4.jar:/Users/gregederer/dev/precip/lib/commons-
>> net-1.4.1.jar:/Users/gregederer/dev/precip/lib/
>> concurrent-1.3.2.jar:/Users/gregederer/dev/precip/lib/
>> dom4j-1.6.1.jar:/Users/gregederer/dev/precip/lib/ehcache-1.2.3.jar:/
>> Users/gregederer/dev/precip/lib/hibernate-spatial-1.0-M1.jar:/Users/
>> gregederer/dev/precip/lib/hibernate-spatial-postgis-1.0-M1.jar:/
>> Users/gregederer/dev/precip/lib/hibernate3.jar:/Users/gregederer/
>> dev/precip/lib/jacc-1_0-fr.jar:/Users/gregederer/dev/precip/lib/
>> javacsv.jar:/Users/gregederer/dev/precip/lib/jaxen-1.1-beta-7.jar:/
>> Users/gregederer/dev/precip/lib/jdbc2_0-stdext.jar:/Users/
>> gregederer/dev/precip/lib/jdom.jar:/Users/gregederer/dev/precip/lib/
>> jta.jar:/Users/gregederer/dev/precip/lib/jts-1.8.jar:/Users/
>> gregederer/dev/precip/lib/jtsio-1.8.jar:/Users/gregederer/dev/
>> precip/lib/jxl.jar:/Users/gregederer/dev/precip/lib/
>> log4j-1.2.11.jar:/Users/gregederer/dev/precip/lib/postgis.jar:/
>> Users/gregederer/dev/precip/lib/postgresql-8.2-508.jdbc3.jar:/Users/
>> gregederer/dev/precip/lib/tar.jar:/Users/gregederer/dev/precip/lib/
>> xerces.jar:/Users/gregederer/dev/precip/lib/xml-apis.jar:/Users/
>> gregederer/dev/precip/bin'
>>
>> The postgis.jar is there, I see only one postgtresql JDBC driver jar.
>>
>> Again, thanks!  I think we're getting closer.
>>
>> Greg
>>
>> Karel Maesen wrote:
>>    
>>> I just checked. Using "jdbc:postgresql_POSTGIS" doesn't work on my
>>> system either.
>>>
>>> Is it possible that you have somewhere else a postgresql driver on
>>> the classpath (try running ant with the -verbose option)?
>>>
>>>
>>> On 06 Feb 2008, at 20:43, Greg Ederer wrote:
>>>
>>>
>>>      
>>>> Hi Karel,
>>>>
>>>> I see that ant reports:
>>>>
>>>>      [java] 11:08:22,256  INFO SettingsFactory:89 - RDBMS:  
>>>> PostgreSQL,
>>>> version: 8.2.5
>>>>      [java] 11:08:22,257  INFO SettingsFactory:90 - JDBC driver:
>>>> PostgreSQL Native Driver, version: PostgreSQL 8.1 JDBC3 with SSL
>>>> (build 407)
>>>>
>>>> which is odd because I'm using postgresql-8.2-508.jdbc3.jar.
>>>>
>>>> When I switched to jdbc:postgresql_postGIS://localhost:5432/testdb,
>>>> I got:
>>>>
>>>>      [java] 11:38:32,244  WARN JDBCExceptionReporter:77 - SQL
>>>> Error: 0,
>>>> SQLState: 08001
>>>>      [java] 11:38:32,245 ERROR JDBCExceptionReporter:78 - No
>>>> suitable driver
>>>>      [java] Exception in thread "main"
>>>> org.hibernate.exception.JDBCConnectionException: Cannot open
>>>> connection
>>>>      [java]     at
>>>> org.hibernate.exception.SQLStateConverter.convert
>>>> (SQLStateConverter.java:74)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:43)
>>>>      [java]     at
>>>> org.hibernate.exception.JDBCExceptionHelper.convert
>>>> (JDBCExceptionHelper.java:29)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:426)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.getConnection
>>>> (ConnectionManager.java:144)
>>>>      [java]     at
>>>> org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:119)
>>>>      [java]     at
>>>> org.hibernate.transaction.JDBCTransaction.begin
>>>> (JDBCTransaction.java:57)
>>>>      [java]     at
>>>> org.hibernate.impl.SessionImpl.beginTransaction(SessionImpl.java:
>>>> 1326)
>>>>      [java]     at sun.reflect.NativeMethodAccessorImpl.invoke0
>>>> (Native
>>>> Method)
>>>>      [java]     at
>>>> sun.reflect.NativeMethodAccessorImpl.invoke
>>>> (NativeMethodAccessorImpl.java:39)
>>>>      [java]     at
>>>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>>>> (DelegatingMethodAccessorImpl.java:25)
>>>>      [java]     at java.lang.reflect.Method.invoke(Method.java:585)
>>>>      [java]     at
>>>> org.hibernate.context.ThreadLocalSessionContext
>>>> $TransactionProtectionWrapper.invoke(ThreadLocalSessionContext.java:
>>>> 301)
>>>>      [java]     at $Proxy0.beginTransaction(Unknown Source)
>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>> Source)
>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>> Source)
>>>>      [java] Caused by: java.sql.SQLException: No suitable driver
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:545)
>>>>      [java]     at
>>>> java.sql.DriverManager.getConnection(DriverManager.java:140)
>>>>      [java]     at
>>>> org.hibernate.connection.DriverManagerConnectionProvider.getConnecti
>>>> on
>>>> (DriverManagerConnectionProvider.java:110)
>>>>      [java]     at
>>>> org.hibernate.jdbc.ConnectionManager.openConnection
>>>> (ConnectionManager.java:423)
>>>>      [java]     ... 12 more
>>>>      [java] Java Result: 1
>>>>
>>>> Cheers,
>>>>
>>>> Greg
>>>>
>>>> Karel Maesen wrote:
>>>>
>>>>        
>>>>> Hi Greg,
>>>>>
>>>>> The postgresql + postgis do not return PGgeometry (or Geometry)
>>>>> objects but "plain" PGobjects. Since postgis.jar is correctly
>>>>> installed, it seems that the postgresql jdbc driver fails to  
>>>>> register
>>>>> the postgis supplied geometry types. Could you check whether you  
>>>>> have
>>>>> a 8.0 or higher version of the postgresql JDBC driver?
>>>>>
>>>>> You might also try to change in the jdbc URL  "jdbc:postgresql"
>>>>> into  "jdbc:postgresql_postGIS" (in the hibernate.cfg.xml file).  
>>>>> This
>>>>> uses the postgis DriverWrapper which registers the geometry types
>>>>> explicitly.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Karel
>>>>>
>>>>>
>>>>> On 06 Feb 2008, at 20:16, gederer wrote:
>>>>>
>>>>>
>>>>>
>>>>>          
>>>>>> Hi Karel,
>>>>>>
>>>>>> Thanks for your reply. Here is the result of the query you  
>>>>>> sugested:
>>>>>>
>>>>>> testdb=# select title, astext(loc) from events;
>>>>>>   title   |    astext
>>>>>> ----------+--------------
>>>>>>  My Event | POINT(10 15)
>>>>>> (1 row)
>>>>>>
>>>>>> Also, I saw another post on this list where the 'Can't convert
>>>>>> object of
>>>>>> type org.postgresql.util.PGobject' occurred, and the problem was
>>>>>> solved by
>>>>>> placing postgis.jar on the classpath. I checked to be certain, and
>>>>>> I do have
>>>>>> this jar in my lib directory, and ant is able to find it.
>>>>>>
>>>>>> Thanks!
>>>>>>
>>>>>> Greg
>>>>>>
>>>>>>
>>>>>> gederer wrote:
>>>>>>
>>>>>>
>>>>>>            
>>>>>>> Hi,
>>>>>>>
>>>>>>> I'm working off of the tutorial at
>>>>>>> http://www.hibernatespatial.org/tutorial.html.  I have been able
>>>>>>> to load a
>>>>>>> point into the database via:
>>>>>>>
>>>>>>>   ant run -Daction=store -Dgeom="POINT(10 15)"
>>>>>>>
>>>>>>> But, when I run:
>>>>>>>
>>>>>>>   ant run -Daction=find -Dgeom="POLYGON((1 1,20 1,20 20, 1 20, 1
>>>>>>> 1))"
>>>>>>>
>>>>>>> after modifying the main method and adding the find method, I get
>>>>>>> this
>>>>>>> output:
>>>>>>>
>>>>>>>      [java] Filter is : POLYGON ((1 1, 20 1, 20 20, 1 20, 1 1))
>>>>>>>      [java] 10:27:51,219 DEBUG SQL:401 - select this_.EVENT_ID as
>>>>>>> EVENT1_0_0_, this_.EVENT_DATE as EVENT2_0_0_, this_.title as
>>>>>>> title0_0_,
>>>>>>> this_.LOC as LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND
>>>>>>> within(this_.LOC, ?))
>>>>>>>      [java] Hibernate: select this_.EVENT_ID as EVENT1_0_0_,
>>>>>>> this_.EVENT_DATE as EVENT2_0_0_, this_.title as title0_0_,
>>>>>>> this_.LOC as
>>>>>>> LOC0_0_ from EVENTS this_ where (this_.LOC && ?  AND   within
>>>>>>> (this_.LOC,
>>>>>>> ?))
>>>>>>>      [java] Exception in thread "main"
>>>>>>> java.lang.IllegalArgumentException:
>>>>>>> Can't convert object of type org.postgresql.util.PGobject
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>>>>>>> (PGGeometryUserType.java:120)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>>>>>>> (AbstractDBGeometryType.java:127)
>>>>>>>      [java]     at
>>>>>>> org.hibernatespatial.GeometryUserType.nullSafeGet
>>>>>>> (GeometryUserType.java:170)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>>>>>>> (AbstractEntityPersister.java:2096)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:
>>>>>>> 1308)
>>>>>>>      [java]     at org.hibernate.loader.Loader.getRow
>>>>>>> (Loader.java:
>>>>>>> 1206)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doQuery
>>>>>>> (Loader.java:
>>>>>>> 701)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollection
>>>>>>> s
>>>>>>> (Loader.java:236)
>>>>>>>      [java]     at org.hibernate.loader.Loader.doList
>>>>>>> (Loader.java:
>>>>>>> 2220)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:
>>>>>>> 2104)
>>>>>>>      [java]     at org.hibernate.loader.Loader.list(Loader.java:
>>>>>>> 2099)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.loader.criteria.CriteriaLoader.list
>>>>>>> (CriteriaLoader.java:94)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.SessionImpl.list(SessionImpl.java:1569)
>>>>>>>      [java]     at
>>>>>>> org.hibernate.impl.CriteriaImpl.list(CriteriaImpl.java:283)
>>>>>>>      [java]     at org.earthserve.model.EventManager.find(Unknown
>>>>>>> Source)
>>>>>>>      [java]     at org.earthserve.model.EventManager.main(Unknown
>>>>>>> Source)
>>>>>>>      [java] Java Result: 1
>>>>>>>
>>>>>>> I'm using PostgreSQL 8.2.5-3 and PostGIS 1.3.2-1a from
>>>>>>> kyngchaos. Any
>>>>>>> suggestions?
>>>>>>>
>>>>>>> Thanks!
>>>>>>>
>>>>>>> Greg
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>              
>>>>>> --
>>>>>> View this message in context: http://www.nabble.com/Can%27t- 
>>>>>> convert-
>>>>>> object-of-type-org.postgresql.util.PGobject-
>>>>>> tp15310652p15311498.html
>>>>>> Sent from the Hibernate Spatial - Users mailing list archive at
>>>>>> Nabble.com.
>>>>>>
>>>>>> _______________________________________________
>>>>>> hibernatespatial-users mailing list
>>>>>> hibernatespatial-users@lists.hibernatespatial.org
>>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>>> hibernatespatial-users
>>>>>>
>>>>>>
>>>>>>            
>>>>> _______________________________________________
>>>>> hibernatespatial-users mailing list
>>>>> hibernatespatial-users@lists.hibernatespatial.org
>>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>>> hibernatespatial-users
>>>>>
>>>>>
>>>>>          
>>>> --
>>>> | E R G O N O S I S
>>>> | Greg Ederer
>>>> | Lead Developer
>>>> | greg@ergonosis.com
>>>> | 360.774.6848
>>>> |
>>>>
>>>> _______________________________________________
>>>> hibernatespatial-users mailing list
>>>> hibernatespatial-users@lists.hibernatespatial.org
>>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>>>> hibernatespatial-users
>>>>
>>>>        
>>> _______________________________________________
>>> hibernatespatial-users mailing list
>>> hibernatespatial-users@lists.hibernatespatial.org
>>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>>> hibernatespatial-users
>>>
>>>      
>> --
>> | E R G O N O S I S
>> | Greg Ederer
>> | Lead Developer
>> | greg@ergonosis.com
>> | 360.774.6848
>> |
>>
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> hibernatespatial-users@lists.hibernatespatial.org
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>    
>
> _______________________________________________
> hibernatespatial-users mailing list
> hibernatespatial-users@lists.hibernatespatial.org
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
>  


--
| E R G O N O S I S
| Greg Ederer
| Lead Developer
| greg@ergonosis.com
| 360.774.6848
|

_______________________________________________
hibernatespatial-users mailing list
hibernatespatial-users@lists.hibernatespatial.org
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
jbella

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

Reply Threaded More More options
Print post
Permalink
In reply to this post by Greg Ederer
Sorry.. I suppose I should give a few details.

I am running:
 
PostgreSQL 8.3
PostGIS 1.3.3
(Running on MacOS X 10.5 - I got the binary distributions from http://www.kyngchaos.com/wiki/software:postgres)
postgresql-8.2-508.jdbc3.jar
hibernate-spatial-1.0-M1.jar
hibernate-spatial-postgis-1.0-M1.jar
jts-1.8.jar
postgis_1.3.2.jar
hibernate 3.2.5
Spring framework version 2.5.4



I'm trying to run a quick test with junit... where I just load a class with a geometry object in it.
This is the annotation I use in the POJO:

@Column (name="geom", columnDefinition = "GEOMETRY")
    @Type( type="org.hibernatespatial.GeometryUserType")
    public Point getGeom() {
        return geom;
    }


The Datasource id loaded by Spring, and I use the SpringDAOSupport with Hibernate.

When I try to run the test. I get the following error:

java.lang.IllegalArgumentException: Can't convert object of type org.postgresql.util.PGobject
        at org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserType.java:120)
        at org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryType.java:127)
        at org.hibernatespatial.GeometryUserType.nullSafeGet(GeometryUserType.java:170)
        at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
        at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
        at org.hibernate.persister.entity.AbstractEntityPersister.hydrate(AbstractEntityPersister.java:2096)
        at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
        at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
        at org.hibernate.loader.Loader.getRow(Loader.java:1206)
        at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
        at org.hibernate.loader.Loader.doQuery(Loader.java:701)
        at org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections(Loader.java:236)
        at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
        at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:48)
        at org.hibernate.loader.entity.AbstractEntityLoader.load(AbstractEntityLoader.java:42)
        at org.hibernate.persister.entity.AbstractEntityPersister.load(AbstractEntityPersister.java:3044)
        at org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource(DefaultLoadEventListener.java:395)
        at org.hibernate.event.def.DefaultLoadEventListener.doLoad(DefaultLoadEventListener.java:375)
        at org.hibernate.event.def.DefaultLoadEventListener.load(DefaultLoadEventListener.java:139)
        at org.hibernate.event.def.DefaultLoadEventListener.onLoad(DefaultLoadEventListener.java:98)
        at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
        at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:836)
        at org.hibernate.proxy.AbstractLazyInitializer.initialize(AbstractLazyInitializer.java:66)
        at org.hibernate.proxy.AbstractLazyInitializer.getImplementation(AbstractLazyInitializer.java:111)
        at org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke(CGLIBLazyInitializer.java:150)
        at com.foo.model.Listing$$EnhancerByCGLIB$$43c73506.getGeom(<generated>)
        at com.foo.dao.ListingDAOTest.testLoadListing(ListingDAOTest.java:29)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at org.springframework.test.context.junit4.SpringTestMethod.invoke(SpringTestMethod.java:198)
        at org.springframework.test.context.junit4.SpringMethodRoadie.runTestMethod(SpringMethodRoadie.java:274)
        at org.springframework.test.context.junit4.SpringMethodRoadie$2.run(SpringMethodRoadie.java:207)
        at org.springframework.test.context.junit4.SpringMethodRoadie.runBeforesThenTestThenAfters(SpringMethodRoadie.java:254)
        at org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepetitions(SpringMethodRoadie.java:234)
        at org.springframework.test.context.junit4.SpringMethodRoadie.runTest(SpringMethodRoadie.java:204)
        at org.springframework.test.context.junit4.SpringMethodRoadie.run(SpringMethodRoadie.java:146)
        at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invokeTestMethod(SpringJUnit4ClassRunner.java:151)
        at org.junit.internal.runners.JUnit4ClassRunner.runMethods(JUnit4ClassRunner.java:51)
        at org.junit.internal.runners.JUnit4ClassRunner$1.run(JUnit4ClassRunner.java:44)
        at org.junit.internal.runners.ClassRoadie.runUnprotected(ClassRoadie.java:27)
        at org.junit.internal.runners.ClassRoadie.runProtected(ClassRoadie.java:37)
        at org.junit.internal.runners.JUnit4ClassRunner.run(JUnit4ClassRunner.java:42)
        at com.intellij.rt.junit4.Junit4ClassSuite.run(Junit4ClassSuite.java:85)
        at com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:40)


I have tried swapping out the driver to DriverWrapper, and I have tried different versions of the postgis.jar and postgresql driver. Nothing seems to have an effect.  Has anyone found a solution to this problem? Oh.. and I hear it's something that happens on the Mac, but not on other OSs. I am going to run a test to find out if that is true.

thanks!
joe

Karel Maesen

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

Reply Threaded More More options
Print post
Permalink
Hi,

This problem seems to occur only on the Mac. Now I use Hibernate  
Spatial also on the Mac and I don't have any problems.

Could you post the table structure, as reported by the describe command?

You should also check this mail in the list: http://www.nabble.com/ 
forum/ViewPost.jtp?post=15363598&framed=y

You could see if you get the same result as Greg.

Regards,

Karel

On 24 Jun 2008, at 23:51, jbella wrote:

>
> Sorry.. I suppose I should give a few details.
>
> I am running:
>
> PostgreSQL 8.3
> PostGIS 1.3.3
> (Running on MacOS X 10.5 - I got the binary distributions from
> http://www.kyngchaos.com/wiki/software:postgres)
> postgresql-8.2-508.jdbc3.jar
> hibernate-spatial-1.0-M1.jar
> hibernate-spatial-postgis-1.0-M1.jar
> jts-1.8.jar
> postgis_1.3.2.jar
> hibernate 3.2.5
> Spring framework version 2.5.4
>
>
>
> I'm trying to run a quick test with junit... where I just load a  
> class with
> a geometry object in it.
> This is the annotation I use in the POJO:
>
> @Column (name="geom", columnDefinition = "GEOMETRY")
>     @Type( type="org.hibernatespatial.GeometryUserType")
>     public Point getGeom() {
>         return geom;
>     }
>
>
> The Datasource id loaded by Spring, and I use the SpringDAOSupport  
> with
> Hibernate.
>
> When I try to run the test. I get the following error:
>
> java.lang.IllegalArgumentException: Can't convert object of type
> org.postgresql.util.PGobject
> at
> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
> (PGGeometryUserType.java:120)
> at
> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
> (AbstractDBGeometryType.java:127)
> at
> org.hibernatespatial.GeometryUserType.nullSafeGet
> (GeometryUserType.java:170)
> at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
> at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
> at
> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
> (AbstractEntityPersister.java:2096)
> at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
> at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:1308)
> at org.hibernate.loader.Loader.getRow(Loader.java:1206)
> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
> at org.hibernate.loader.Loader.doQuery(Loader.java:701)
> at
> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
> (Loader.java:236)
> at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
> at
> org.hibernate.loader.entity.AbstractEntityLoader.load
> (AbstractEntityLoader.java:48)
> at
> org.hibernate.loader.entity.AbstractEntityLoader.load
> (AbstractEntityLoader.java:42)
> at
> org.hibernate.persister.entity.AbstractEntityPersister.load
> (AbstractEntityPersister.java:3044)
> at
> org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource
> (DefaultLoadEventListener.java:395)
> at
> org.hibernate.event.def.DefaultLoadEventListener.doLoad
> (DefaultLoadEventListener.java:375)
> at
> org.hibernate.event.def.DefaultLoadEventListener.load
> (DefaultLoadEventListener.java:139)
> at
> org.hibernate.event.def.DefaultLoadEventListener.onLoad
> (DefaultLoadEventListener.java:98)
> at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
> at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:836)
> at
> org.hibernate.proxy.AbstractLazyInitializer.initialize
> (AbstractLazyInitializer.java:66)
> at
> org.hibernate.proxy.AbstractLazyInitializer.getImplementation
> (AbstractLazyInitializer.java:111)
> at
> org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke
> (CGLIBLazyInitializer.java:150)
> at com.foo.model.Listing$$EnhancerByCGLIB$$43c73506.getGeom
> (<generated>)
> at com.foo.dao.ListingDAOTest.testLoadListing(ListingDAOTest.java:29)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at
> sun.reflect.NativeMethodAccessorImpl.invoke
> (NativeMethodAccessorImpl.java:39)
> at
> sun.reflect.DelegatingMethodAccessorImpl.invoke
> (DelegatingMethodAccessorImpl.java:25)
> at
> org.springframework.test.context.junit4.SpringTestMethod.invoke
> (SpringTestMethod.java:198)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runTestMeth
> od(SpringMethodRoadie.java:274)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie$2.run
> (SpringMethodRoadie.java:207)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runBeforesT
> henTestThenAfters(SpringMethodRoadie.java:254)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runWithRepe
> titions(SpringMethodRoadie.java:234)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.runTest
> (SpringMethodRoadie.java:204)
> at
> org.springframework.test.context.junit4.SpringMethodRoadie.run
> (SpringMethodRoadie.java:146)
> at
> org.springframework.test.context.junit4.SpringJUnit4ClassRunner.invoke
> TestMethod(SpringJUnit4ClassRunner.java:151)
> at
> org.junit.internal.runners.JUnit4ClassRunner.runMethods
> (JUnit4ClassRunner.java:51)
> at
> org.junit.internal.runners.JUnit4ClassRunner$1.run
> (JUnit4ClassRunner.java:44)
> at
> org.junit.internal.runners.ClassRoadie.runUnprotected
> (ClassRoadie.java:27)
> at org.junit.internal.runners.ClassRoadie.runProtected
> (ClassRoadie.java:37)
> at
> org.junit.internal.runners.JUnit4ClassRunner.run
> (JUnit4ClassRunner.java:42)
> at com.intellij.rt.junit4.Junit4ClassSuite.run
> (Junit4ClassSuite.java:85)
> at com.intellij.rt.execution.junit.JUnitStarter.main
> (JUnitStarter.java:40)
>
>
> I have tried swapping out the driver to DriverWrapper, and I have  
> tried
> different versions of the postgis.jar and postgresql driver.  
> Nothing seems
> to have an effect.  Has anyone found a solution to this problem?  
> Oh.. and I
> hear it's something that happens on the Mac, but not on other OSs.  
> I am
> going to run a test to find out if that is true.
>
> thanks!
> joe
>
>
> --
> View this message in context: http://www.nabble.com/Can%27t-convert- 
> object-of-type-org.postgresql.util.PGobject-tp15310652p18075260.html
> Sent from the Hibernate Spatial - Users mailing list archive at  
> Nabble.com.
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
> hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users
jbella

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

Reply Threaded More More options
Print post
Permalink
Hi Karel,

yes, I noticed it seems to be a Mac problem because the same code  
works fine on our servers running Ubuntu server.

Here is the description of the table I am trying to access:


                             Table "public.mlsdata"
       Column       |          Type          |            Modifiers
-------------------+------------------------
+---------------------------------
  id                | integer                | not null default 0
  entry_date        | date                   |
  sale_type         | character varying(15)  | default NULL::character  
varying
  price_min_bid     | double precision       |
  auction_dt        | date                   |
  auction_type      | character varying(15)  | default NULL::character  
varying
  last_revd         | date                   |
  last_change       | character varying(11)  | default NULL::character  
varying
  city              | character varying(33)  | default NULL::character  
varying
  state             | character varying(4)   | default NULL::character  
varying
  address           | character varying(34)  | default NULL::character  
varying
  zip               | integer                | default 0
  ppty_name         | character varying(34)  | default NULL::character  
varying
  ppty_id           | character varying(14)  | default NULL::character  
varying
  metro             | character varying(34)  | default NULL::character  
varying
  county            | character varying(255) | default NULL::character  
varying
  land_v_bldg       | character varying(6)   | default NULL::character  
varying
  ppty_type         | character varying(15)  | default NULL::character  
varying
  size              | integer                |
  units             | character varying(15)  | default NULL::character  
varying
  built             | integer                |
  zoning            | character varying(15)  | default NULL::character  
varying
  bedrooms          | double precision       |
  baths             | double precision       |
  comments          | text                   |
  lstg_company      | character varying(50)  | default NULL::character  
varying
  phone_number      | character varying(40)  | default NULL::character  
varying
  contact           | character varying(50)  | default NULL::character  
varying
  resid_v_comm      | character varying(6)   | default NULL::character  
varying
  record_id         | character varying(13)  | default NULL::character  
varying
  phone2            | character varying(50)  | default NULL::character  
varying
  contact2          | character varying(255) | default NULL::character  
varying
  reolist_dt        | date                   |
  lister_number     | character varying(10)  | default NULL::character  
varying
  date_last_change  | date                   |
  photo             | character varying(255) | default NULL::character  
varying
  validated_address | character varying(255) | default NULL::character  
varying
  email             | character varying(255) | default NULL::character  
varying
  lat               | character varying(25)  | default NULL::character  
varying
  lon               | character varying(25)  | default NULL::character  
varying
  geocoded_new      | character varying      |
  geo_result_code   | integer                |
  geo_check         | character varying      |
  geo_distance      | double precision       |
  geom              | geometry               |
Indexes:
     "mlsdata_geom_index" gist (geom)
Check constraints:
     "enforce_dims_geom" CHECK (ndims(geom) = 2)
     "enforce_geotype_geom" CHECK (geometrytype(geom) = 'POINT'::text  
OR geom IS NULL)
     "enforce_srid_geom" CHECK (srid(geom) = 4269)
     "mlsdata_geo_check_check" CHECK (geo_check::text = ANY  
(ARRAY['ERROR'::character varying, 'ZIP'::character varying,  
'CITY'::character varying]::text[]))
     "mlsdata_geocoded_new_check" CHECK (geocoded_new::text = ANY  
(ARRAY['GOOGLE'::character varying, 'CITY'::character varying,  
'ZIP'::character varying]::text[]))
     "mlsdata_price_min_bid_check" CHECK (price_min_bid >= 0::double  
precision)
     "mlsdata_zip_check" CHECK (zip >= 0)


I can get objects and access any of hte other fields.. but as soon as  
I try to access the geom field it blows up.
The 'geom' field is the only geometry field in the table.

This code will eventually be run on tomcat 5.5 running java 1.5, but  
the error I am seeing right now happens when I try to run a junit test  
case:

  @Test
     public void testLoadListing()
     {
         Listing aListing = listingDAO.get(209419L);
         Assert.assertNotNull(aListing.getGeom());
     }

I am running the test case inside IntelliJ.

I am very encouraged that you are using a Mac and have this working.

joe



On Jun 25, 2008, at 2:47 AM, Karel Maesen wrote:

> Hi,
>
> This problem seems to occur only on the Mac. Now I use Hibernate
> Spatial also on the Mac and I don't have any problems.
>
> Could you post the table structure, as reported by the describe  
> command?
>
> You should also check this mail in the list: http://www.nabble.com/
> forum/ViewPost.jtp?post=15363598&framed=y
>
> You could see if you get the same result as Greg.
>
> Regards,
>
> Karel
>
> On 24 Jun 2008, at 23:51, jbella wrote:
>
>>
>> Sorry.. I suppose I should give a few details.
>>
>> I am running:
>>
>> PostgreSQL 8.3
>> PostGIS 1.3.3
>> (Running on MacOS X 10.5 - I got the binary distributions from
>> http://www.kyngchaos.com/wiki/software:postgres)
>> postgresql-8.2-508.jdbc3.jar
>> hibernate-spatial-1.0-M1.jar
>> hibernate-spatial-postgis-1.0-M1.jar
>> jts-1.8.jar
>> postgis_1.3.2.jar
>> hibernate 3.2.5
>> Spring framework version 2.5.4
>>
>>
>>
>> I'm trying to run a quick test with junit... where I just load a
>> class with
>> a geometry object in it.
>> This is the annotation I use in the POJO:
>>
>> @Column (name="geom", columnDefinition = "GEOMETRY")
>>    @Type( type="org.hibernatespatial.GeometryUserType")
>>    public Point getGeom() {
>>        return geom;
>>    }
>>
>>
>> The Datasource id loaded by Spring, and I use the SpringDAOSupport
>> with
>> Hibernate.
>>
>> When I try to run the test. I get the following error:
>>
>> java.lang.IllegalArgumentException: Can't convert object of type
>> org.postgresql.util.PGobject
>> at
>> org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS
>> (PGGeometryUserType.java:120)
>> at
>> org.hibernatespatial.AbstractDBGeometryType.nullSafeGet
>> (AbstractDBGeometryType.java:127)
>> at
>> org.hibernatespatial.GeometryUserType.nullSafeGet
>> (GeometryUserType.java:170)
>> at org.hibernate.type.CustomType.nullSafeGet(CustomType.java:105)
>> at org.hibernate.type.AbstractType.hydrate(AbstractType.java:81)
>> at
>> org.hibernate.persister.entity.AbstractEntityPersister.hydrate
>> (AbstractEntityPersister.java:2096)
>> at org.hibernate.loader.Loader.loadFromResultSet(Loader.java:1380)
>> at org.hibernate.loader.Loader.instanceNotYetLoaded(Loader.java:
>> 1308)
>> at org.hibernate.loader.Loader.getRow(Loader.java:1206)
>> at org.hibernate.loader.Loader.getRowFromResultSet(Loader.java:580)
>> at org.hibernate.loader.Loader.doQuery(Loader.java:701)
>> at
>> org.hibernate.loader.Loader.doQueryAndInitializeNonLazyCollections
>> (Loader.java:236)
>> at org.hibernate.loader.Loader.loadEntity(Loader.java:1860)
>> at
>> org.hibernate.loader.entity.AbstractEntityLoader.load
>> (AbstractEntityLoader.java:48)
>> at
>> org.hibernate.loader.entity.AbstractEntityLoader.load
>> (AbstractEntityLoader.java:42)
>> at
>> org.hibernate.persister.entity.AbstractEntityPersister.load
>> (AbstractEntityPersister.java:3044)
>> at
>> org.hibernate.event.def.DefaultLoadEventListener.loadFromDatasource
>> (DefaultLoadEventListener.java:395)
>> at
>> org.hibernate.event.def.DefaultLoadEventListener.doLoad
>> (DefaultLoadEventListener.java:375)
>> at
>> org.hibernate.event.def.DefaultLoadEventListener.load
>> (DefaultLoadEventListener.java:139)
>> at
>> org.hibernate.event.def.DefaultLoadEventListener.onLoad
>> (DefaultLoadEventListener.java:98)
>> at org.hibernate.impl.SessionImpl.fireLoad(SessionImpl.java:878)
>> at org.hibernate.impl.SessionImpl.immediateLoad(SessionImpl.java:
>> 836)
>> at
>> org.hibernate.proxy.AbstractLazyInitializer.initialize
>> (AbstractLazyInitializer.java:66)
>> at
>> org.hibernate.proxy.AbstractLazyInitializer.getImplementation
>> (AbstractLazyInitializer.java:111)
>> at
>> org.hibernate.proxy.pojo.cglib.CGLIBLazyInitializer.invoke
>> (CGLIBLazyInitializer.java:150)
>> at com.foo.model.Listing$$EnhancerByCGLIB$$43c73506.getGeom
>> (<generated>)
>> at com.foo.dao.ListingDAOTest.testLoadListing(ListingDAOTest.java:
>> 29)
>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>> at
>> sun.reflect.NativeMethodAccessorImpl.invoke
>> (NativeMethodAccessorImpl.java:39)
>> at
>> sun.reflect.DelegatingMethodAccessorImpl.invoke
>> (DelegatingMethodAccessorImpl.java:25)
>> at
>> org.springframework.test.context.junit4.SpringTestMethod.invoke
>> (SpringTestMethod.java:198)
>> at
>> org
>> .springframework.test.context.junit4.SpringMethodRoadie.runTestMeth
>> od(SpringMethodRoadie.java:274)
>> at
>> org.springframework.test.context.junit4.SpringMethodRoadie$2.run
>> (SpringMethodRoadie.java:207)
>> at
>> org
>> .springframework.test.context.junit4.SpringMethodRoadie.runBeforesT
>> henTestThenAfters(SpringMethodRoadie.java:254)
>> at
>> org
>> .springframework.test.context.junit4.SpringMethodRoadie.runWithRepe
>> titions(SpringMethodRoadie.java:234)
>> at
>> org.springframework.test.context.junit4.SpringMethodRoadie.runTest
>> (SpringMethodRoadie.java:204)
>> at
>> org.springframework.test.context.junit4.SpringMethodRoadie.run
>> (SpringMethodRoadie.java:146)
>> at
>> org
>> .springframework.test.context.junit4.SpringJUnit4ClassRunner.invoke
>> TestMethod(SpringJUnit4ClassRunner.java:151)
>> at
>> org.junit.internal.runners.JUnit4ClassRunner.runMethods
>> (JUnit4ClassRunner.java:51)
>> at
>> org.junit.internal.runners.JUnit4ClassRunner$1.run
>> (JUnit4ClassRunner.java:44)
>> at
>> org.junit.internal.runners.ClassRoadie.runUnprotected
>> (ClassRoadie.java:27)
>> at org.junit.internal.runners.ClassRoadie.runProtected
>> (ClassRoadie.java:37)
>> at
>> org.junit.internal.runners.JUnit4ClassRunner.run
>> (JUnit4ClassRunner.java:42)
>> at com.intellij.rt.junit4.Junit4ClassSuite.run
>> (Junit4ClassSuite.java:85)
>> at com.intellij.rt.execution.junit.JUnitStarter.main
>> (JUnitStarter.java:40)
>>
>>
>> I have tried swapping out the driver to DriverWrapper, and I have
>> tried
>> different versions of the postgis.jar and postgresql driver.
>> Nothing seems
>> to have an effect.  Has anyone found a solution to this problem?
>> Oh.. and I
>> hear it's something that happens on the Mac, but not on other OSs.
>> I am
>> going to run a test to find out if that is true.
>>
>> thanks!
>> joe
>>
>>
>> --
>> View this message in context: http://www.nabble.com/Can%27t-convert-
>> object-of-type-org.postgresql.util.PGobject-tp15310652p18075260.html
>> Sent from the Hibernate Spatial - Users mailing list archive at
>> Nabble.com.
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/
>> hibernatespatial-users
>
> _______________________________________________
> hibernatespatial-users mailing list
> [hidden email]
> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users

_______________________________________________
hibernatespatial-users mailing list
[hidden email]
http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users