I'm using Spring with Hibernate to do the DB-handling. Everything works fine except when I try to store a LOB object in the oracle DB. I get the following DataAccessResourceFailureException which is in fact a wrapper for a [java.rmi.MarshalException] :
First of all I am using : Spring 1.1.1, Weblogic 8.1sp3, oracle 9i, oracle driver = oracle.jdbc.xa.client.OracleXADataSource
Here's what I have in the applicationContext concerning hibernate and transactions :
Is the problem the driver [oracle.jdbc.xa.client.OracleXADataSource] I'm using or the fact that I'm testing this via Junit which extend AbstractSpringContextTests ?
Any help is highly appreciated and if you need more info let me know !
Did you check that you have the correct oracle drivers for oracle 9 in your classpath? I believe this is classes12.zip for jdk1.2 and jdk1.3 and ojdbc14.jar for jdk1.4.
And do you really need an XADataSource? Because (maybe you already know this) this is only necessary when your transaction have to deal with multiple databases. Otherwise you should just use the non XA datasource.
Hope this helps you in someway, Lars
Joined: Nov 28, 2001
Thanks for the info. I'm using JDK1.4 and the oracle driver used in the client application is : odjbc14_g.jar. If I use the odjbc14.jar I get an 'java.lang.ArrayIndexOutOfBoundsException' so it's still not working.
Joined: Aug 05, 2005
Does the stacktrace of the ArrayIndexOutOfBounds gives you more information about where this exception occurs? Maybe you can try to insert a LOB with the driver jar in a standalone application to verify it works without WebLogic, Hibernate and Spring.
What i find strange is that in your first post the cause of the Exception was
Caused by: weblogic.rmi.extensions.RemoteRuntimeException: Unexpected Exception - with nested exception:[java.rmi.MarshalException: error marshalling return; nested exception is: java.io.NotSerializableException: oracle.jdbc.driver.LogicalConnection]
I cannot find this class (oracle.jdbc.driver.LogicalConnection) in the jdbc driver jars, also a google search came up with nothing. Is this a generated class or so?
Joined: Nov 28, 2001
I don't know, I'm just using the ojdbc14_g.jar and it's not in there like you said...
I've tried something else instead of working with WebLogicNativeJdbcExtractor
I now work with the SimpleNativeJdbcExtractor :
and this gives me another error :
and in my Spring logging I see a message of dehydrating entity and then "the Connection [null] for given Connection handle"
BTW thanks for looking into this ! :-)
Joined: Aug 05, 2005
I did some more research and maybe found something interesting information concerning the SimpleNativeJdbcExtractor you use as nativeJdbcExtractor. In the javadocs of the SimpleNativeJdbcExtractor it says:
This extractor should work with any pool that does not wrap DatabaseMetaData, and will also work with any plain JDBC driver. Note that a pool can still wrap Statements, PreparedStatements, etc: The only requirement of this extractor is that java.sql.DatabaseMetaData does not get wrapped, returning the native Connection of the JDBC driver on metaData.getConnection().
The 'interesting information' here is the fact that it states that if you want to use this class the java.sql.DatabaseMetaData does not get wrapped and returns the native Connection of the JDBC driver on metaData.getConnection(). In your case it apparently doesn't because it is returning null after invoking the getMetaData().getConnection() in the method doGetNativeConnection of the class SimpleNativeJdbcExtractor. If you look into this method you'll see the DEBUG statement 'Returning native Connection [null] for given ....' being called there. Why the WebLogicNativeJdbcExtractor failes, I do not know (I have never worked with Weblogic). But my guess (and I am just guessing here...) is that it is on the same point (also the method doGetNativeConnection of the class WebLogicNativeJdbcExtractor. What I find strange in the exception trace is that the figure 813 is in the name of the connection implementation class of Weblogic.
Maybe this is refering to an older Oracle version 8.1.3? Maybe there is an older oracle driver jar/zip or something like that in the classpath or libpath, or maybe the jdbc/native drivers of weblogic need to be upgraded?