Forum Stats

  • 3,816,002 Users
  • 2,259,128 Discussions
  • 7,893,362 Comments

Discussions

XMLType exception with 12c JDBC

user10199246
user10199246 Member Posts: 5

Hello:

We are attempting to create an XMLType object from a string in order to enqueue the object onto an AQ queue.  This has worked fine with 10g, 11g JDBC drivers, but runs into trouble with the 12c JDBC driver.  During runtime a ClassDefNotFound exception is thrown for oracle.xdb.XMLType.  Has anyone else had similar issues using XMLType with the 12c thin JDBC driver?  This is in a WebSphere 8.5 environment.

Snippet below:

public Message createMessage (Connection conn, Session session, String xmlMessage) {

XMLType payload = null;

AdtMessage msg = null;

payload =XMLType.createXML((java.sql.Connection) conn, xmlMessage);

msg = ((AQjmsSession) session).createORAMessage(payload);

return msg;

StackTrace:

Exception:java.lang.NoClassDefFoundError SourceId:com.ibm.ejs.container.BusinessExceptionMappingStrategy.setUncheckedException ProbeId:506 Reporter:[email protected]

java.lang.NoClassDefFoundError: oracle.xdb.XMLType

at java.lang.J9VMInternals.verifyImpl(Native Method)

at java.lang.J9VMInternals.verify(J9VMInternals.java:93)

at java.lang.J9VMInternals.initialize(J9VMInternals.java:170)

at oracle.jdbc.oracore.OracleTypeADT.applyTDSpatches(OracleTypeADT.java:1081)

at oracle.jdbc.oracore.OracleTypeADT.parseTDSrec(OracleTypeADT.java:1002)

at oracle.jdbc.oracore.OracleTypeADT.parseTDS(OracleTypeADT.java:936)

at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:489)

at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:470)

at oracle.sql.OpaqueDescriptor.initPickler(OpaqueDescriptor.java:258)

at oracle.sql.OpaqueDescriptor.<init>(OpaqueDescriptor.java:75)

at oracle.sql.OpaqueDescriptor.createDescriptor(OpaqueDescriptor.java:180)

at oracle.xdb.XMLType.<init>(XMLType.java:951)

at oracle.xdb.XMLType.createXML(XMLType.java:1082)

at oracle.xdb.XMLType.createXML(XMLType.java:1072)

at <...>.jms.aq.AQMessageCreator.createPayload(Unknown Source)

at <...>.jms.aq.AQMessageCreator.createMessage(Unknown Source)

at <...>.jms.aq.AQMessageSender.send(Unknown Source)

... 153 more

Caused by: java.lang.ClassNotFoundException: oracle.xdb.XMLType

at java.net.URLClassLoader.findClass(URLClassLoader.java:599)

at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:204)

at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:743)

at java.lang.ClassLoader.loadClass(ClassLoader.java:720)

at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:119)

at java.lang.ClassLoader.loadClass(ClassLoader.java:690)

... 170 more

Tagged:

Answers

  • Add xdb6.jar to the classpath as that is where XMLType is defined.

    dsurber-Oracle
  • Add xdb6.jar to the classpath as that is where XMLType is defined.

    Are you thinking that OP has the xdb.jar in the classpath now and that is why they made this statement?

    This has worked fine with 10g, 11g JDBC drivers, but runs into trouble with the 12c JDBC driver.
  • Thanks for the replies.

    RE: 10g, 11g JDBC drivers, I mention that as hopefully some kind of differentiator.  In our environment, we have ojdbc6.jar and ojdbc7.jar loaded at the WebSphere app server level (they're in the .../AppServer/lib directory).  We have xdb6.jar, xmlparserv2.jar, aqapi.jar, and other related jars packaged with the EAR.  When I switch out the 12c ojdbc6.jar, xdb6.jar, xmlparserv2.jar and put in the 11g versions, all works OK.  I put in the 12c versions of these JARs in the same locations, I get the runtime error.  The stack trace shows calls to XMLType methods, so it definitely looks like it can find XMLType.

    We also have Spring 2.5 in the mix.  Are there any known conflicts there?

  • If you have both ojdbc6.jar and ojdbc7.jar in the classpath and/or both xdb.jar and xdb6.jar nothing will work. Only one ojdbc*.jar file in the classpath. Only one xdb*.jar file in the classpath. When using the 12 driver, whether ojdbc6.jar or ojdbc7.jar I strongly recommend using xdk6.jar.

  • Thanks again for the reply.  Sorry for my mistype. We don't have both JDBC jars in the classpath.  Only ojdbc6.jar is in the classpath for the server. xdb6.jar and xmlparserv2.jar are in the classpath at the EAR level.


  • That doesn't make sense to me. I don't see how this could be true:

    When I switch out the 12c ojdbc6.jar, xdb6.jar, xmlparserv2.jar and put in the 11g versions, all works OK. 
    

    Look at your exception trace:

    at oracle.jdbc.oracore.OracleTypeADT.init(OracleTypeADT.java:470)
    . . .
    at oracle.xdb.XMLType.createXML(XMLType.java:1082)
    

    Those 'oracle.jdcb. . ' classes are in the ojdbc jar files but the 'oracle.xdb. . .' classes are in the xdb6.jar.

    How do you expect it to work if one jar is on the server and the other on the client?

    My guess is that, perhaps unknown to you, you had either the ojdbc or the xdb jar on BOTH the client and the server.

  • gimbal2
    gimbal2 Member Posts: 11,949 Gold Trophy
    rp0428 wrote:
    
    My guess is that, perhaps unknown to you, you had either the ojdbc or the xdb jar on BOTH the client and the server.
    

    That took a while for me to make that click. You mean that in both the mentioned environments one of the jars is missing, correct?

  • Unknown
    edited Apr 17, 2014 11:23AM
    You mean that in both the mentioned environments one of the jars is missing, correct?

    Yes - I was commenting on this last post by OP

    Only ojdbc6.jar is in the classpath for the server. xdb6.jar and xmlparserv2.jar are in the classpath at the EAR level.

    If OP means that ojdbc6.jar is ONLY in the classpath for the server then there is NO jdbc jar on the client with the xdb6 jar file. This is what OP said even earlier

    In our environment, we have ojdbc6.jar and ojdbc7.jar loaded at the WebSphere app server level (they're in the .../AppServer/lib directory).  We have xdb6.jar, xmlparserv2.jar, aqapi.jar, and other related jars packaged with the EAR. 

    There is no specific mention there of the jdbc jar with the ear on the client.

    The XMLTYPE API shows that every constructor needs the connection as an argument - meaning you need the JDBC jar file as well as the xdb6.jar file.

    http://docs.oracle.com/cd/B14099_19/web.1012/b12024/oracle/xdb/XMLType.html

    Of course, as usual, OPs question is about a problem with the code yet they don't actually post any code. I've never understood how that makes sense to those whose post questions.

This discussion has been closed.