在创建oracle.sql.Clob对象时出现ClassCastException。
错误:
java.lang.ClassCastException: weblogic.jdbc.wrapper.JTAConnection_weblogic_jdbc_wrapper_XAConnection_oracle_jdbc_driver_LogicalConnection cannot be cast to oracle.jdbc.OracleConnection
at oracle.sql.CLOB.createTemporary(CLOB.java:868)
at oracle.sql.CLOB.createTemporary(CLOB.java:828)
Java代码:
InitialContext ic = new InitialContext();
DataSource dsds = (DataSource)ic.lookup("valid_ds_name");
Connection conn = ds.getConnection();
CLOB clob = CLOB.createTemporary(connection, false, CLOB.MODE_READWRITE);
weblogic.xml
<?xml version="1.0" encoding="UTF-8"?>
<weblogic-web-app xmlns="http://xmlns.oracle.com/weblogic/weblogic-web-app">
<context-root>/PNPRESTAPI</context-root>
<container-descriptor>
<prefer-web-inf-classes>true</prefer-web-inf-classes>
</container-descriptor>
</weblogic-web-app>
包括的罐子:
ojdbc6.jar