|
|
|
Bas Couwenberg
|
Hello,
first of all I want to say that hibernatespatial is a great project which saved me alot of work and problems during development of my webapplication.
During this development process I always tested my application on an Tomcat webserver which works perfect. Now recently I've been trying to deploy the application on a Oracle Application Server and I get the stacktrace below. Do you know if this has something to do with the jdbc drivers or are there known issues with Oracle Application Server? I use the following versions:
Tomcat 5.0.28
Oracle Application Server 10.1.3.1.0
hibernate-spatial-1.0-M1.jar
hibernate-spatial-oracle-1.0-M1.jar
17:08:53,875 ERROR FoutBean:? - Unexpected error: at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:372) at x at x at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at x at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at x at com.luciad.ogc.wfs.u.a(Unknown Source) _______________________________________________ hibernatespatial-users mailing list [hidden email] http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users |
||||||||||||||||
|
Karel Maesen
|
Hi Bas,
On 20 Feb 2008, at 09:10, Bas Couwenberg wrote: > > first of all I want to say that hibernatespatial is a great project > which saved me alot of work and problems during development of my > webapplication. It's always nice to hear from a satisfied user. > During this development process I always tested my application on > an Tomcat webserver which works perfect. Now recently I've been > trying to deploy the application on a Oracle Application Server and > I get the stacktrace below. Do you know if this has something to do > with the jdbc drivers or are there known issues with Oracle > Application Server? I use the following versions: > > Tomcat 5.0.28 > Oracle Application Server 10.1.3.1.0 > hibernate-spatial-1.0-M1.jar > hibernate-spatial-oracle-1.0-M1.jar > It looks like you have a problem with the JDBC driver. An exception is thrown when Hibernate Spatial tries to create an Oracle STRUCT object. Apparently one of the arguments is invalid. You are connecting to the same database as when you use Tomcat? The following code snippet would recreate the problem and only depends on using Oracle JDBC. You might try to run this code and use it to further diagnose the problem. ... OracleConnection conn = ... StructDescriptor descr = StructDescriptor.createDescriptor ("MDSYS.SDO_ELEM_INFO_ARRAY", conn); ... I haven't heard of any specific problems with Oracle AS. My advice is to ensure that you use the exact same JDBC driver in Oracle AS as you used in Tomcat. Regards, Karel Maesen _______________________________________________ hibernatespatial-users mailing list [hidden email] http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users |
||||||||||||||||
|
Bas Couwenberg
|
Hello,
after some further investigation I discovered that the method findOracleConnection in the class SDOGeometryType returns NULL when using OAS. This because the method gets a Connection of the type oracle_jdbc_driver_LogicalConnection_Proxy (with Tomcat I get a org.apache.commons.dbcp.PoolableConnection) and it can't get the internal connection or a connection of type OracleConnection. When I remove all of the casts which are performed with the connection variable, that is retrieved with PreparedStatement.getConnection(), such as: (OracleConnection) connection and use the Connection class in the methods instead of OracleConnection it works with OAS. But now I changed this hard coded and removed the recursive function in the method findOracleConnection which I think is needed for other application servers. Can you give me advice about how to deal with this problem?
Regards,
Bas Couwenberg
On Wed, Feb 20, 2008 at 10:06 PM, Karel Maesen <[hidden email]> wrote: Hi Bas, _______________________________________________ hibernatespatial-users mailing list [hidden email] http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users |
||||||||||||||||
|
Karel Maesen
|
Hi Bas,
Could you create a patch so I can see the changes you made to get to work? Could you also check whether this oracle_jdbc_driver_LogicalConnection_Proxy is a genuine dynamic proxy (i.e. if java.lang.reflect.Proxy.isProxyClass (oracle_jdbc_driver_LogicalConnection_Proxy.class) return true)? This issue keeps cropping up with Oracle. To create an Oracle SDO_GEOMETRY we need an Oracle STRUCT instance, which can only be created when you have an OracleConnection object. Unfortunately, in a managed environment the Connection objects are usually wrapped or proxied and not directly available. This is why we have the findOracleConnection function, but that clearly cannot handle all cases. See the discussion on this list related to C3P0, where the same problems occur. In that discussion I proposed to break out the findOracleConnection function in a seperate class so that the strategy of getting an appropriate Connection can be override depending on the environment. If you send me that patch, it will help me to create an appropriate interface. In any case, I will change the code so that the finder does not return a null object. Regards, Karel Maesen On 22 Feb 2008, at 12:21, Bas Couwenberg wrote: > Hello, > > after some further investigation I discovered that the method > findOracleConnection in the class SDOGeometryType returns NULL when > using OAS. This because the method gets a Connection of the type > oracle_jdbc_driver_LogicalConnection_Proxy (with Tomcat I get a > org.apache.commons.dbcp.PoolableConnection) and it can't get the > internal connection or a connection of type OracleConnection. When > I remove all of the casts which are performed with the connection > variable, that is retrieved with PreparedStatement.getConnection(), > such as: (OracleConnection) connection and use the Connection class > in the methods instead of OracleConnection it works with OAS. But > now I changed this hard coded and removed the recursive function in > the method findOracleConnection which I think is needed for other > application servers. Can you give me advice about how to deal with > this problem? > > Regards, > > Bas Couwenberg > > > On Wed, Feb 20, 2008 at 10:06 PM, Karel Maesen <[hidden email]> > wrote: > Hi Bas, > > > On 20 Feb 2008, at 09:10, Bas Couwenberg wrote: > > > > first of all I want to say that hibernatespatial is a great project > > which saved me alot of work and problems during development of my > > webapplication. > > It's always nice to hear from a satisfied user. > > > During this development process I always tested my application on > > an Tomcat webserver which works perfect. Now recently I've been > > trying to deploy the application on a Oracle Application Server and > > I get the stacktrace below. Do you know if this has something to do > > with the jdbc drivers or are there known issues with Oracle > > Application Server? I use the following versions: > > > > Tomcat 5.0.28 > > Oracle Application Server 10.1.3.1.0 > > hibernate-spatial-1.0-M1.jar > > hibernate-spatial-oracle-1.0-M1.jar > > > > > It looks like you have a problem with the JDBC driver. An exception > is thrown when Hibernate Spatial tries to create an Oracle STRUCT > object. Apparently one of the arguments is invalid. You are > connecting to the same database as when you use Tomcat? > > The following code snippet would recreate the problem and only > depends on using Oracle JDBC. You might try to run this code and use > it to further diagnose the problem. > > ... > OracleConnection conn = ... > StructDescriptor descr = StructDescriptor.createDescriptor > ("MDSYS.SDO_ELEM_INFO_ARRAY", conn); > ... > > I haven't heard of any specific problems with Oracle AS. My advice is > to ensure that you use the exact same JDBC driver in Oracle AS as you > used in Tomcat. > > Regards, > > Karel Maesen > > _______________________________________________ > 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 |
||||||||||||||||
|
Bas Couwenberg
|
Hello,
sorry for the long wait but I was talking about the issue with Oracle too. They haven't given me a proper solution yet for the proxy object so I made some changes to the SDOGeometryType.java to see if it solves my problem. The isProxyClass method returned false with the proxy object. But it seems that by directly returning the proxy object to the StructDescriptor, the STRUCT is created correctly. I don't think the changes I made are a good solution but it worked for me on JBoss, Tomcat and OAS which is important because we need to support all these servers.
Could you tell me if the license of the project permits me of changing and building the library for our application? I really need this feature because of a major release of our application coming up in which it must be deployed on OAS. The changes I made are in the attachment as a patch.
Greetings,
Bas Couwenberg
On Fri, Feb 22, 2008 at 1:14 PM, Karel Maesen <[hidden email]> wrote:
Hi Bas, Index: src/main/java/org/hibernatespatial/oracle/SDOGeometryType.java =================================================================== --- src/main/java/org/hibernatespatial/oracle/SDOGeometryType.java (revision 92) +++ src/main/java/org/hibernatespatial/oracle/SDOGeometryType.java (working copy) @@ -95,7 +95,7 @@ SDO_GEOMETRY geom = convertJTSGeometry(jtsGeom); if (geom != null) try { - return SDO_GEOMETRY.store(geom, (OracleConnection) connection); + return SDO_GEOMETRY.store(geom, connection); } catch (SQLException e) { throw new HibernateSpatialException( "Problem during conversion from JTS to JGeometry", e); @@ -154,22 +154,28 @@ * @param con * @return */ - private OracleConnection findOracleConnection(Connection con) { + private Connection findOracleConnection(Connection con) { if (con == null) { return null; } if (con instanceof OracleConnection) { return (OracleConnection) con; } + // try to find the Oracleconnection recursively - + for (Method method : con.getClass().getMethods()) { if (method.getReturnType().isAssignableFrom( java.sql.Connection.class) && method.getParameterTypes().length == 0) { try { - return findOracleConnection((java.sql.Connection) (method - .invoke(con, new Object[] {}))); + Connection unwrappedCon = (java.sql.Connection) (method.invoke(con, new Object[] {})); + if(unwrappedCon == null) { + return con; + } + else { + return findOracleConnection(unwrappedCon); + } } catch (Exception e) { // Shouldm't ever happen. } @@ -1232,7 +1238,7 @@ return ea; } - public ARRAY toOracleArray(OracleConnection conn) throws SQLException { + public ARRAY toOracleArray(Connection conn) throws SQLException { if (arrayDescriptor == null) { arrayDescriptor = ArrayDescriptor.createDescriptor(TYPE_NAME, @@ -1304,7 +1310,7 @@ this.ordinates = newOrdinates; } - public ARRAY toOracleArray(OracleConnection conn) throws SQLException { + public ARRAY toOracleArray(Connection conn) throws SQLException { if (arrayDescriptor == null) { arrayDescriptor = ArrayDescriptor.createDescriptor(TYPE_NAME, conn); @@ -1433,7 +1439,7 @@ return geom; } - public static STRUCT store(SDO_GEOMETRY geom, OracleConnection conn) + public static STRUCT store(SDO_GEOMETRY geom, Connection conn) throws SQLException { if (structDescriptor == null) { _______________________________________________ hibernatespatial-users mailing list [hidden email] http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users |
||||||||||||||||
|
Karel Maesen
|
Hi,
On 26 Feb 2008, at 10:41, Bas Couwenberg wrote: > sorry for the long wait but I was talking about the issue with > Oracle too. They haven't given me a proper solution yet for the > proxy object so I made some changes to the SDOGeometryType.java to > see if it solves my problem. The isProxyClass method returned > false with the proxy object. But it seems that by directly > returning the proxy object to the StructDescriptor, the STRUCT is > created correctly. If Oracle gets back to you with some information, I'd appreciate it if you share this with me. > I don't think the changes I made are a good solution but it worked > for me on JBoss, Tomcat and OAS which is important because we need > to support all these servers. > Could you tell me if the license of the project permits me of > changing and building the library for our application? I really > need this feature because of a major release of our application > coming up in which it must be deployed on OAS. The changes I made > are in the attachment as a patch. The library is licensed under LGPL, v2.1. As with most open-source licenses, you are free to modify the source without restrictions or conditions as long as you don't re-distribute the modified library. I guess that this is the case here. If you do distribute the modified library (e.g. when you sell copies of your application), you must comply with the conditions of the LGPL, esp. art. 2 (see: http:// www.gnu.org/licenses/old-licenses/lgpl-2.1.html). Thanks for the patch. It will help me improve the Oracle Provider. Regards, Karel Maesen _______________________________________________ hibernatespatial-users mailing list [hidden email] http://www.hibernatespatial.org/cgi-bin/mailman/listinfo/hibernatespatial-users |
||||||||||||||||
|
maskellp
|
Hi,
I am using hibernate-spatial-oracle-1.0-M2.jar not M1 that this post mentions and I am still getting this issue, having looked at the code in SDOGeometryType there is now only one mention of OracleConnection so changes have been made since the patch in this post was mentioned. Does anyone have any work arounds for this? Thanks in advance. Phil Maskell
|
||||||||||||||||
| Free Embeddable Forum Powered by Nabble | Help |