撤消XML类型列时出错

时间:2015-10-03 19:06:15

标签: java xml oracle

我正在尝试从XML类型列中检索一些Node 我的代码在我的本地环境中可以在Tomcat中正常工作,但是当我创建一个EAR文件并将其部署到WeSphere Application Server中时。它给了我错误

Caused by: java.lang.NoClassDefFoundError: oracle.xdb.XMLType
    at oracle.jdbc.driver.NamedTypeAccessor.getOracleObject(NamedTypeAccessor.java:249)
    at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:136)
    at oracle.jdbc.driver.NamedTypeAccessor.getObject(NamedTypeAccessor.java:110)
    at oracle.jdbc.driver.GeneratedStatement.getObject(GeneratedStatement.java:261)
    at oracle.jdbc.driver.GeneratedScrollableResultSet.getObject(GeneratedScrollableResultSet.java:761)
    at com.ibm.ws.rsadapter.jdbc.WSJdbcResultSet.getObject(WSJdbcResultSet.java:1919)
    at com.ibm._jsp._appGetAssetContent._jspService(_appGetAssetContent.java:137)
    ... 26 more
Caused by: java.lang.ClassNotFoundException: oracle.xdb.XMLType
    at java.net.URLClassLoader.findClass(URLClassLoader.java:666)
    at com.ibm.ws.bootstrap.ExtClassLoader.findClass(ExtClassLoader.java:243)
    at java.lang.ClassLoader.loadClassHelper(ClassLoader.java:942)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:877)
    at com.ibm.ws.bootstrap.ExtClassLoader.loadClass(ExtClassLoader.java:134)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:847)
    ... 33 more

我的代码是

XMLType poxml = null;
String dataElXml= null;

try{
Context ctx= new InitialContext();
DataSource ds=(DataSource)ctx.lookup(dsource);
Connection Conn=ds.getConnection();
Statement Stmt=Conn.createStatement(); 
String itemID=request.getParameter("cat");
ResultSet rs=Stmt.executeQuery("SELECT TA.COLUMNNAME.extract('/data-pac/data-e')  FROM Tablename TA WHERE ID = "+itemID+"");

Integer j=0;

while(rs.next()) {
ok = true;
poxml = (XMLType)rs.getObject(1);

1 个答案:

答案 0 :(得分:0)

您必须下载xdb<version>.jar并添加到您的类路径中。这包含类oracle.xdb.XMLType