Android-Apache Commons DbUtils-QueryRunner异常

时间:2018-12-07 13:36:48

标签: java android jdbc apache-commons apache-commons-dbutils

我在我的应用程序中使用Apache Commons DbUtils(https://commons.apache.org/proper/commons-dbutils/)。

我将jar文件(commons-dbutils-1.7.jar)添加到libs文件夹中。然后我有这段代码:

             ResultSetHandler<List<Objekt>> h = new BeanListHandler<Objekt>(Objekt.class);
             QueryRunner run = new QueryRunner();
             List<Objekt> persons = run.query(conn, "select * from C_OBJEKT", h);

在最后一行,我得到了这个异常:

12-12 14:33:46.939 24150-24210/com.tempus.touch W/art: Unresolved exception class when finding catch block: java.beans.IntrospectionException
12-12 14:33:46.939 24150-24210/com.tempus.touch E/AndroidRuntime: FATAL EXCEPTION: AsyncTask #1
    Process: com.tempus.touch, PID: 24150
    java.lang.NoClassDefFoundError: Failed resolution of: Ljava/beans/Introspector;
        at org.apache.commons.dbutils.BeanProcessor.propertyDescriptors(BeanProcessor.java:432)
        at org.apache.commons.dbutils.BeanProcessor.toBeanList(BeanProcessor.java:197)
        at org.apache.commons.dbutils.BasicRowProcessor.toBeanList(BasicRowProcessor.java:140)
        at org.apache.commons.dbutils.handlers.BeanListHandler.handle(BeanListHandler.java:83)
        at org.apache.commons.dbutils.handlers.BeanListHandler.handle(BeanListHandler.java:34)
        at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:388)
        at org.apache.commons.dbutils.QueryRunner.query(QueryRunner.java:266)
        at com.tempus.touch.MainActivity$3.run(MainActivity.java:160)
        at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:234)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
        at java.lang.Thread.run(Thread.java:818)
     Caused by: java.lang.ClassNotFoundException: Didn't find class "java.beans.Introspector" on path: DexPathList[[zip file "/data/app/com.tempus.touch-1/base.apk", zip file "/data/app/com.tempus.touch-1/split_lib_dependencies_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_0_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_1_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_2_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_3_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_4_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_5_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_6_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_7_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_8_apk.apk", zip file "/data/app/com.tempus.touch-1/split_lib_slice_9_apk.apk"],nativeLibraryDirectories=[/data/app/com.tempus.touch-1/lib/arm, /vendor/lib, /system/lib]]

怎么了?我该怎么办?导入其他库?

谢谢您的帮助!

0 个答案:

没有答案