简体   繁体   中英

Uncaught Throwable java.lang.AbstractMethodError: org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.createArrayOf

I getting below error while trying to call con.createArrayOf method on Microsoft SQL server with datasource pool connection

Uncaught Throwable java.lang.AbstractMethodError: org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.createArrayOf(Ljava/lang/String;[Ljava/lang/Object;)Ljava/sql/Array;

Any lead would be appreciable.

Basically, you can't use the createArrayOf method with your current library. You'll have to use a different database driver library.

You could use something like https://docs.microsoft.com/en-us/sql/connect/jdbc/microsoft-jdbc-driver-for-sql-server since you're using SQL Server.

The error suggests you are using Apache DBCP 1.3 or older, as the method you are trying to call was introduced in JDBC 4 (Java 6), while Apache DBCP 1.3 supports JDBC 3 (Java 1.4/5).

Given the overview at https://commons.apache.org/proper/commons-dbcp/ you need to use at minimum Apache DBCP 1.4, or a newer version (the latest is 2.7.0, for Java 8 and higher).

Note though that upgrading won't help you much, because the Microsoft SQL Server JDBC driver implementation of createArrayOf will throw a SQLFeatureNotSupportedException as SQL Server doesn't support arrays.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

Related Question java.lang.AbstractMethodError: org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper.getClientInfo()Ljava/util/Properties; java.lang.AbstractMethodError: org.apache.commons.dbcp.PoolingDataSource throwing exception while using innermost class of org.apache.commons.dbcp.PoolingDataSource$PoolGuardConnectionWrapper Caused by: java.lang.ClassCastException: org.apache.commons.dbcp.PoolingDataSource cannot be cast to javax.sql.DataSource Apache Commons DBCP connection object problem, Thread: ClassCastException in org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper java.lang.ClassCastException: org.apache.tomcat.dbcp.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection java.lang.AbstractMethodError: at org.apache.tomcat.dbcp.dbcp.DelegatingPreparedStatement.setCharacterStream(DelegatingPreparedStatement.java:328) java.lang.AbstractMethodError: org.sqlite.Conn.createArrayOf error while calling createArrayOf method on sqlite org.apache.tomcat.dbcp.dbcp.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to com.mysql.jdbc.Connection org.apache.tomcat.dbcp.dbcp2.PoolingDataSource$PoolGuardConnectionWrapper cannot be cast to oracle.jdbc.OracleConnection
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM