Unable to extract table with Geo data from DB

3 messages Options
Embed this post
Permalink
wxFlatt

Unable to extract table with Geo data from DB

Reply Threaded More More options
Print post
Permalink
Some javascript/style in this post has been disabled (why?)

Well, I seem to still have problems getting Geometry data out of the DB.

 

I am using linux Redhat Enterprise 4 on an Intel 64 bit machine.

I just upgraded to PostgreSQL 8.3.5 and PostGIS 1.3.3. I get the same error with this setup as I did with PostgreSQL 8.2 and PostGIS 1.2.

 

I have Hibernate set up and am able to extract info from a table that contains no Geo data.

When I ask for data from a table with a Point defined, I get the following error…

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

 

Just prior to this error is the SQL statement where it is making the call to get the data. When I make this SQL command myself in pgsql, I get a line of data no problem with the Point field in a binary representation.

 

I saw where this was a problem with Mac usage.

 

I am using the following libraries…

Jts-1.8.jar

hibernate-spatial-1.0-M2.jar

hibernate-spatial-postgis-1.0-M2.jar

postgis.jar

postgresql-8.3-603.jdbc2ee.jar

 

The postgis.jar file was created by me in the PostGIS 1.3.3 directory.

 

Paul Flatt

Warning Coordination Meteorologist

National Weather Service

3833 S. Development Ave.

Boise, Idaho 83705

 

(208) 334-9861 x223

 

********  weather.gov/boise ********

 


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

Re: Unable to extract table with Geo data from DB

Reply Threaded More More options
Print post
Permalink
Hi Paul,

Could you post the stacktrace of the error? I'll try to reproduce the  
results on a virtual machine here.

Regards,

Karel Maesen

On 14 Nov 2008, at 16:10, Paul Flatt wrote:

> Well, I seem to still have problems getting Geometry data out of  
> the DB.
>
>
>
> I am using linux Redhat Enterprise 4 on an Intel 64 bit machine.
>
> I just upgraded to PostgreSQL 8.3.5 and PostGIS 1.3.3. I get the  
> same error with this setup as I did with PostgreSQL 8.2 and PostGIS  
> 1.2.
>
>
>
> I have Hibernate set up and am able to extract info from a table  
> that contains no Geo data.
>
> When I ask for data from a table with a Point defined, I get the  
> following error…
>
> Can’t convert object of type org.postgresql.util.PGobject
>
>
>
> Just prior to this error is the SQL statement where it is making  
> the call to get the data. When I make this SQL command myself in  
> pgsql, I get a line of data no problem with the Point field in a  
> binary representation.
>
>
>
> I saw where this was a problem with Mac usage.
>
>
>
> I am using the following libraries…
>
> Jts-1.8.jar
>
> hibernate-spatial-1.0-M2.jar
>
> hibernate-spatial-postgis-1.0-M2.jar
>
> postgis.jar
>
> postgresql-8.3-603.jdbc2ee.jar
>
>
>
> The postgis.jar file was created by me in the PostGIS 1.3.3 directory.
>
>
>
> Paul Flatt
>
> Warning Coordination Meteorologist
>
> National Weather Service
>
> 3833 S. Development Ave.
>
> Boise, Idaho 83705
>
>
>
> (208) 334-9861 x223
>
>
>
> ********  weather.gov/boise ********
>
>
>
> _______________________________________________
> 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
wxFlatt

Re: Unable to extract table with Geo data from DB

Reply Threaded More More options
Print post
Permalink
Here is the subroutine that is making the call to get the data (With several
print statements so I could see where it fails. The first 3 statements show
up in the log below then no more)...

Thank you very much for your help,
---------------------------

    public List getCities(String clause) {
        List<City> cities = null;
        City city;
        try {
System.out.println("*** Here we are\n");
            org.hibernate.Transaction tx = session.beginTransaction();
System.out.println("*** 1 Here we are\n");
            Query q = session.createQuery("from City WHERE id<10");
System.out.println("*** 2 Here we are after createQuery()\n");
            List prf = q.list();
System.out.println("*** 2.1 Here we are after q.list() with
n="+prf.size()+"\n");
            tx.commit();
System.out.println("*** 2.5 Here we are after tx.commit() with
n="+prf.size()+"\n");
            cities = (List<City>) q.list();
System.out.println("*** 3 Here we are after cities = q.list\n");
System.out.println("\n*** Number of items returned = "+cities.size()+"\n");
            for (int i = 0; i < cities.size(); i++ ){
                    city = (City)cities.get(i);
                System.out.println("ID: " + city.getId() +
                                ", Elevation: " + city.getElevation() +
                                ", Name: " + city.getName());
            }

        } catch (Exception e) {
            e.printStackTrace();
        }

        return cities;
    }

---------------------
And here is the log picking up with the first of the print statements
above...
The lon_lat variable is defined as a Point in the database. All other
variables are integer or string.
----------------------

[#|2008-11-18T03:55:42.427-0700|INFO|sun-appserver9.1|javax.enterprise.syste
m.stream.out|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-0;|
*** Here we are
|#]

[#|2008-11-18T03:55:42.435-0700|INFO|sun-appserver9.1|javax.enterprise.syste
m.stream.out|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-0;|
*** 1 Here we are
|#]

[#|2008-11-18T03:55:42.438-0700|INFO|sun-appserver9.1|javax.enterprise.syste
m.stream.out|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-0;|
*** 2 Here we are after createQuery()
|#]

[#|2008-11-18T03:55:42.438-0700|INFO|sun-appserver9.1|javax.enterprise.syste
m.stream.out|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-0;|
Hibernate: select city0_.id as id7_, city0_.county_fips as county2_7_,
city0_.name as name7_, city0_.subfips as subfips7_, city0_.elevation as
elevation7_, city0_.lon_lat as lon6_7_, city0_.population as population7_
from iris.city city0_ where city0_.id<10|#]

[#|2008-11-18T03:55:42.956-0700|WARNING|sun-appserver9.1|javax.enterprise.sy
stem.stream.err|_ThreadID=17;_ThreadName=httpSSLWorkerThread-8080-0;_Request
ID=46904b8c-f4d7-459e-be3b-e76e6c7872ff;|
java.lang.IllegalArgumentException: Can't convert object of type
org.postgresql.util.PGobject
        at
org.hibernatespatial.postgis.PGGeometryUserType.convert2JTS(PGGeometryUserTy
pe.java:123)
        at
org.hibernatespatial.AbstractDBGeometryType.nullSafeGet(AbstractDBGeometryTy
pe.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(AbstractEntit
yPersister.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.ja
va:236)
        at org.hibernate.loader.Loader.doList(Loader.java:2220)
        at
org.hibernate.loader.Loader.listIgnoreQueryCache(Loader.java:2104)
        at org.hibernate.loader.Loader.list(Loader.java:2099)
        at org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:378)
        at
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:338)
        at
org.hibernate.engine.query.HQLQueryPlan.performList(HQLQueryPlan.java:172)
        at org.hibernate.impl.SessionImpl.list(SessionImpl.java:1121)
        at org.hibernate.impl.QueryImpl.list(QueryImpl.java:79)
        at data.CityHelper.getCities(CityHelper.java:52)
        at org.apache.jsp.ecity_jsp._jspService(ecity_jsp.java from :76)
        at
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:93)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
73)
        at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:470)
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:364)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:831)
        at
org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFi
lterChain.java:411)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:290)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContext
Valve.java:271)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:202)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632
)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577
)
        at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:206
)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632
)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577
)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:150)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:632
)
        at
org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:577
)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:571)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1080)
        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:272)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(
DefaultProcessorTask.java:637)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(Defa
ultProcessorTask.java:568)
        at
com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(Defaul
tProcessorTask.java:813)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTas
k(DefaultReadTask.java:341)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadT
ask.java:263)
        at
com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadT
ask.java:214)
        at
com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
        at
com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerTh
read.java:106)

-----Original Message-----
From: [hidden email]
[mailto:[hidden email]] On Behalf
Of Karel Maesen
Sent: Tuesday, November 18, 2008 1:54 AM
To: [hidden email]; Hibernate Spatial Users Discussion
Subject: Re: [hibernatespatial-users] Unable to extract table with Geo data
from DB

Hi Paul,

Could you post the stacktrace of the error? I'll try to reproduce the  
results on a virtual machine here.

Regards,

Karel Maesen

On 14 Nov 2008, at 16:10, Paul Flatt wrote:

> Well, I seem to still have problems getting Geometry data out of  
> the DB.
>
> I am using linux Redhat Enterprise 4 on an Intel 64 bit machine.
>
> I just upgraded to PostgreSQL 8.3.5 and PostGIS 1.3.3. I get the  
> same error with this setup as I did with PostgreSQL 8.2 and PostGIS  
> 1.2.
>
> I have Hibernate set up and am able to extract info from a table  
> that contains no Geo data.
>
> When I ask for data from a table with a Point defined, I get the  
> following error.
>
> Can't convert object of type org.postgresql.util.PGobject
>
> Just prior to this error is the SQL statement where it is making  
> the call to get the data. When I make this SQL command myself in  
> pgsql, I get a line of data no problem with the Point field in a  
> binary representation.
>
> I saw where this was a problem with Mac usage.
>
> I am using the following libraries.
>
> Jts-1.8.jar
> hibernate-spatial-1.0-M2.jar
> hibernate-spatial-postgis-1.0-M2.jar
> postgis.jar
> postgresql-8.3-603.jdbc2ee.jar
> The postgis.jar file was created by me in the PostGIS 1.3.3 directory.
>
> Paul Flatt
>
> Warning Coordination Meteorologist
> National Weather Service
> 3833 S. Development Ave.
> Boise, Idaho 83705
>
> (208) 334-9861 x223
>
>
>
> ********  weather.gov/boise ********
>
>
>
> _______________________________________________
> 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-us
ers

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