I copied a simple Java application from online developed by Oracle, designed to test the thin and OCI driver for inserting and selecting XMLType objects. The application works for both the thin and OCI drivers. I implemented the same code used to get the XMLType in my application as was implemented in this test application.
My application defines a generic data source in Weblogic and gets the data source using JNDI.
The same ojdbc6.jar and XML DB libraries are used in both applications.
A ClassCastException occurs when attempting to get the XMLType object from the query. The query is also the same as the query used in the test program. The test programs are GetXMLTypeDOM and InsertXMLType. They are based on 2 super classes, BaseApplication and ConnectionProvider. Since they are in an Oracle package, you may know about them...
Here is the exception:
Caused By: java.lang.ClassCastException: oracle.sql.OPAQUE cannot be cast to oracle.xdb.XMLType
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
Truncated. see log file for complete stacktrace
Here is the line of code that fails:
XMLType xml = (XMLType) rs.getObject(1);
An examination of the Javadocs indicate that XMLType derives from OPAQUE.
Not sure why the XMLType is not being returned.
Does anyone know why the XMLType is not being returned and what can be done to get this to work?
Thanks in advance,
Any assistance will be appreciated...
I modified the code to test for the type returned. Just find it odd that it didn't work as it did in my test program... It seems to work; but now I have another issue... I'll post under a different subject...