This discussion is archived
2 Replies Latest reply: Apr 19, 2013 9:35 AM by 959086 RSS

ClassCastException OPAQUE cannot be cast to XMLType

959086 Newbie
Currently Being Moderated
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 gov.va.med.datasharing.audit.web.dao.jdbc.ConfigAuditableEventsQueryDAOImpl.getEventContentXMLType(ConfigAuditableEventsQueryDAOImpl.java:199)
     at gov.va.med.datasharing.audit.web.dao.jdbc.ConfigAuditableEventsQueryDAOImpl.getEventContent(ConfigAuditableEventsQueryDAOImpl.java:164)
     at gov.va.med.datasharing.audit.web.service.ConfigAuditQuerySummaryServiceImpl.getMessageContent(ConfigAuditQuerySummaryServiceImpl.java:185)
     at gov.va.med.datasharing.audit.web.service.ConfigAuditQuerySummaryServiceImpl.detailQuery(ConfigAuditQuerySummaryServiceImpl.java:155)
     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...

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points