ClassCastException when trying to use JGeometry

7 messages Options
Embed this post
Permalink
aarthi.h

ClassCastException when trying to use JGeometry

Reply Threaded More More options
Print post
Permalink
Hi,
I get the following error when trying to use the JGeometry class.  

Caused by: java.lang.ClassCastException: org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to oracle.jdbc.OracleConnection
        at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:181)
        at oracle.sql.StructDescriptor.createDescriptor(StructDescriptor.java:130)
        at oracle.spatial.geometry.JGeometry.createDBDescriptors(JGeometry.java:1321)
        at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1257)
        at org.hibernatespatial.oracle.SDOGeometryType.conv2DBGeometry(SDOGeometryType.java:103)
        at org.hibernatespatial.oracle.SDOGeometryType.nullSafeSet(SDOGeometryType.java:76)
        at org.hibernatespatial.GeometryUserType.nullSafeSet(GeometryUserType.java:183)

When I look at the source code for the SDOGeometryType class, I see a findOracleConnection() method that says that it is specifically for such a problem but I still get this error, nevertheless.
Here's the part of the SDOGeometryType code which I found online that has the part where it tries to cast a Connection to an OracleConnection. I am not sure if this is exactly where it is failing.

 @Override
        public void nullSafeSet(PreparedStatement st, Object value, int index)
                        throws HibernateException, SQLException {
                if (value == null) {
                        st.setNull(index, sqlTypes()[0], SQL_TYPE_NAME);
                } else {
                        Geometry jtsGeom = (Geometry) value;
                        Object dbGeom = conv2DBGeometry(jtsGeom, findOracleConnection(st
                                        .getConnection()));

                        st.setObject(index, dbGeom);
                }
        }

        @Override
        public Object conv2DBGeometry(Geometry jtsGeom, Connection connection) {
                SDO_GEOMETRY geom = convertJTSGeometry(jtsGeom);
                if (geom != null)
                        try {
                                return SDO_GEOMETRY.store(geom, (OracleConnection) connection);



It would be really great if someone can help me out. I really need to get past this error and I could not find anything similar online.

Thanks in advance,
Aarthi
Karel Maesen

Re: ClassCastException when trying to use JGeometry

Reply Threaded More More options
Print post
Permalink
Hi Aarthi,

I think you are looking at the code in the trunk. This code is not  
yet in a binary build.

Could you try and build Hibernate Spatial from source? In the latest  
discussion thread with Sebastien Arbogast you'll find a brief  
discussion on how to do that. That should resolve the issue.

Regards,

Karel Maesen

On 15 Jan 2008, at 01:10, aarthi.h wrote:

>
> Hi,
> I get the following error when trying to use the JGeometry class.
>
> Caused by: java.lang.ClassCastException:
> org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to
> oracle.jdbc.OracleConnection
> at oracle.sql.StructDescriptor.createDescriptor
> (StructDescriptor.java:181)
> at oracle.sql.StructDescriptor.createDescriptor
> (StructDescriptor.java:130)
> at
> oracle.spatial.geometry.JGeometry.createDBDescriptors
> (JGeometry.java:1321)
> at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1257)
> at
> org.hibernatespatial.oracle.SDOGeometryType.conv2DBGeometry
> (SDOGeometryType.java:103)
> at
> org.hibernatespatial.oracle.SDOGeometryType.nullSafeSet
> (SDOGeometryType.java:76)
> at
> org.hibernatespatial.GeometryUserType.nullSafeSet
> (GeometryUserType.java:183)
>
> When I look at the source code for the SDOGeometryType class, I see a
> findOracleConnection() method that says that it is specifically for  
> such a
> problem but I still get this error, nevertheless.
> Can someone please tell me if this is a bug or is there something I  
> can do.
>
> Thanks in advance,
> Aarthi
> --
> View this message in context: http://www.nabble.com/ 
> ClassCastException-when-trying-to-use-JGeometry-
> tp14818727p14818727.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
aarthi.h

Re: ClassCastException when trying to use JGeometry

Reply Threaded More More options
Print post
Permalink
Hi Karel,
Thanks for replying. Is this the post you are talking about?

The easiest way to build Hibernate Spatial is to check out all  
projects from the subversion repository.

 > svn checkout https://intra.geovise.com/svn/hibernate-spatial/trunk 
hibernate-spatial

then move to the hibernate-spatial/hibernate-spatial-maven directory  
and run

 > mvn package  (or mvn install)



Is there an alternative site I could check out the source from as geovise requires a user name and password?
I found this link   http://www.hibernatespatial.org/svn/hibernate-spatial/trunk. If I try to check out the code from there I get the following error.

C:\dev\hibernatespatial>svn checkout http://www.hibernatespatial.org/svn/hibernate-spatial/trunk
svn: REPORT request failed on '/svn/hibernate-spatial/!svn/vcc/default'
svn: REPORT of '/svn/hibernate-spatial/!svn/vcc/default': 400 Bad Request (http:
//www.hibernatespatial.org)



Also, these are the jars I am using :
hibernate-spatial-1.0-20070920.111959-1.jar
hibernate-spatial-oracle-1.0-20070920.111959-1.jar
jts-1.8.jar
sdoapi.jar

and the hibernate version I am currently on is hibernate-3.2.1.ga.jar

Please advice.

Thanks,
Aarthi





Karel Maesen wrote:
Hi Aarthi,

I think you are looking at the code in the trunk. This code is not  
yet in a binary build.

Could you try and build Hibernate Spatial from source? In the latest  
discussion thread with Sebastien Arbogast you'll find a brief  
discussion on how to do that. That should resolve the issue.

Regards,

Karel Maesen

On 15 Jan 2008, at 01:10, aarthi.h wrote:

>
> Hi,
> I get the following error when trying to use the JGeometry class.
>
> Caused by: java.lang.ClassCastException:
> org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to
> oracle.jdbc.OracleConnection
> at oracle.sql.StructDescriptor.createDescriptor
> (StructDescriptor.java:181)
> at oracle.sql.StructDescriptor.createDescriptor
> (StructDescriptor.java:130)
> at
> oracle.spatial.geometry.JGeometry.createDBDescriptors
> (JGeometry.java:1321)
> at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1257)
> at
> org.hibernatespatial.oracle.SDOGeometryType.conv2DBGeometry
> (SDOGeometryType.java:103)
> at
> org.hibernatespatial.oracle.SDOGeometryType.nullSafeSet
> (SDOGeometryType.java:76)
> at
> org.hibernatespatial.GeometryUserType.nullSafeSet
> (GeometryUserType.java:183)
>
> When I look at the source code for the SDOGeometryType class, I see a
> findOracleConnection() method that says that it is specifically for  
> such a
> problem but I still get this error, nevertheless.
> Can someone please tell me if this is a bug or is there something I  
> can do.
>
> Thanks in advance,
> Aarthi
> --
> View this message in context: http://www.nabble.com/ 
> ClassCastException-when-trying-to-use-JGeometry-
> tp14818727p14818727.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
Karel Maesen

Re: ClassCastException when trying to use JGeometry

Reply Threaded More More options
Print post
Permalink
Hi Aarthi,


On 15 Jan 2008, at 20:05, aarthi.h wrote:

>
> Hi Karel,
> Thanks for replying. Is this the post you are talking about?
>
> The easiest way to build Hibernate Spatial is to check out all
> projects from the subversion repository.
>
>> svn checkout https://intra.geovise.com/svn/hibernate-spatial/trunk
> hibernate-spatial
>
> then move to the hibernate-spatial/hibernate-spatial-maven directory
> and run
>
>> mvn package  (or mvn install)
>
>

That's the one.

> Is there an alternative site I could check out the source from as  
> geovise
> requires a user name and password?


The correct link is: svn checkout http://www.hibernatespatial.org/svn/ 
hibernate-spatial/trunk/hibernate-spatial hibernate-spatial

See the page http://www.hibernatespatial.org/source-repository.html

Regards,

Karel

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

Re: ClassCastException when trying to use JGeometry

Reply Threaded More More options
Print post
Permalink
In reply to this post by aarthi.h
Hey Karel,
I checked out the latest build and got it to work. Thanks for your help!

-Aarthi-


aarthi.h wrote:
Hi Karel,
Thanks for replying. Is this the post you are talking about?

The easiest way to build Hibernate Spatial is to check out all  
projects from the subversion repository.

 > svn checkout https://intra.geovise.com/svn/hibernate-spatial/trunk 
hibernate-spatial

then move to the hibernate-spatial/hibernate-spatial-maven directory  
and run

 > mvn package  (or mvn install)



Is there an alternative site I could check out the source from as geovise requires a user name and password?
I found this link   http://www.hibernatespatial.org/svn/hibernate-spatial/trunk. If I try to check out the code from there I get the following error.

C:\dev\hibernatespatial>svn checkout http://www.hibernatespatial.org/svn/hibernate-spatial/trunk
svn: REPORT request failed on '/svn/hibernate-spatial/!svn/vcc/default'
svn: REPORT of '/svn/hibernate-spatial/!svn/vcc/default': 400 Bad Request (http:
//www.hibernatespatial.org)



Also, these are the jars I am using :
hibernate-spatial-1.0-20070920.111959-1.jar
hibernate-spatial-oracle-1.0-20070920.111959-1.jar
jts-1.8.jar
sdoapi.jar

and the hibernate version I am currently on is hibernate-3.2.1.ga.jar

Please advice.

Thanks,
Aarthi





Karel Maesen wrote:
Hi Aarthi,

I think you are looking at the code in the trunk. This code is not  
yet in a binary build.

Could you try and build Hibernate Spatial from source? In the latest  
discussion thread with Sebastien Arbogast you'll find a brief  
discussion on how to do that. That should resolve the issue.

Regards,

Karel Maesen

On 15 Jan 2008, at 01:10, aarthi.h wrote:

>
> Hi,
> I get the following error when trying to use the JGeometry class.
>
> Caused by: java.lang.ClassCastException:
> org.jboss.resource.adapter.jdbc.WrappedConnection cannot be cast to
> oracle.jdbc.OracleConnection
> at oracle.sql.StructDescriptor.createDescriptor
> (StructDescriptor.java:181)
> at oracle.sql.StructDescriptor.createDescriptor
> (StructDescriptor.java:130)
> at
> oracle.spatial.geometry.JGeometry.createDBDescriptors
> (JGeometry.java:1321)
> at oracle.spatial.geometry.JGeometry.store(JGeometry.java:1257)
> at
> org.hibernatespatial.oracle.SDOGeometryType.conv2DBGeometry
> (SDOGeometryType.java:103)
> at
> org.hibernatespatial.oracle.SDOGeometryType.nullSafeSet
> (SDOGeometryType.java:76)
> at
> org.hibernatespatial.GeometryUserType.nullSafeSet
> (GeometryUserType.java:183)
>
> When I look at the source code for the SDOGeometryType class, I see a
> findOracleConnection() method that says that it is specifically for  
> such a
> problem but I still get this error, nevertheless.
> Can someone please tell me if this is a bug or is there something I  
> can do.
>
> Thanks in advance,
> Aarthi
> --
> View this message in context: http://www.nabble.com/ 
> ClassCastException-when-trying-to-use-JGeometry-
> tp14818727p14818727.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
aarthi.h

Re: ClassCastException when trying to use JGeometry

Reply Threaded More More options
Print post
Permalink
In reply to this post by Karel Maesen
Hi Karel,
Can you tell me when the next release is scheduled for?

Thanks
Aarthi


Karel Maesen wrote:
Hi Aarthi,


On 15 Jan 2008, at 20:05, aarthi.h wrote:

>
> Hi Karel,
> Thanks for replying. Is this the post you are talking about?
>
> The easiest way to build Hibernate Spatial is to check out all
> projects from the subversion repository.
>
>> svn checkout https://intra.geovise.com/svn/hibernate-spatial/trunk
> hibernate-spatial
>
> then move to the hibernate-spatial/hibernate-spatial-maven directory
> and run
>
>> mvn package  (or mvn install)
>
>

That's the one.

> Is there an alternative site I could check out the source from as  
> geovise
> requires a user name and password?


The correct link is: svn checkout http://www.hibernatespatial.org/svn/ 
hibernate-spatial/trunk/hibernate-spatial hibernate-spatial

See the page http://www.hibernatespatial.org/source-repository.html

Regards,

Karel

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

Re: ClassCastException when trying to use JGeometry

Reply Threaded More More options
Print post
Permalink

I can only say that it will be in the next couple of weeks.

On 16 Jan 2008, at 00:53, aarthi.h wrote:

>
> Hi Karel,
> Can you tell me when the next release is scheduled for?
>
> Thanks
> Aarthi
>
>
>
> Karel Maesen wrote:
>>
>> Hi Aarthi,
>>
>>
>> On 15 Jan 2008, at 20:05, aarthi.h wrote:
>>
>>>
>>> Hi Karel,
>>> Thanks for replying. Is this the post you are talking about?
>>>
>>> The easiest way to build Hibernate Spatial is to check out all
>>> projects from the subversion repository.
>>>
>>>> svn checkout https://intra.geovise.com/svn/hibernate-spatial/trunk
>>> hibernate-spatial
>>>
>>> then move to the hibernate-spatial/hibernate-spatial-maven directory
>>> and run
>>>
>>>> mvn package  (or mvn install)
>>>
>>>
>>
>> That's the one.
>>
>>> Is there an alternative site I could check out the source from as
>>> geovise
>>> requires a user name and password?
>>
>>
>> The correct link is: svn checkout http://www.hibernatespatial.org/ 
>> svn/
>> hibernate-spatial/trunk/hibernate-spatial hibernate-spatial
>>
>> See the page http://www.hibernatespatial.org/source-repository.html
>>
>> Regards,
>>
>> Karel
>>
>> _______________________________________________
>> hibernatespatial-users mailing list
>> [hidden email]
>> http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/ 
>> hibernatespatial-users
>>
>>
>
> --
> View this message in context: http://www.nabble.com/ 
> ClassCastException-when-trying-to-use-JGeometry-
> tp14818727p14854151.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