1

I'm using in my app Apache Commons DbUtils (https://commons.apache.org/proper/commons-dbutils/).

I added jar file (commons-dbutils-1.7.jar) to the libs folder. Then I have this code:

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

And in the last row I get this exception:

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]]

What's wrong? What should I do? Import some other library?

Thank you for help!

Pepa Zapletal
  • 2,879
  • 3
  • 39
  • 69
  • It appears (based on the error) that `java.beans.Introspector` is not included in Android. In any case, you shouldn't be accessing databases directly from Android anyway. Use a REST service to mediate between your application and the database. – Mark Rotteveel Dec 07 '18 at 14:37
  • Yes, I know. But it's not possible now in this project. So I have to use this option. Do you know how to add java.beans.Introspector to the project/Android? – Pepa Zapletal Dec 07 '18 at 14:55
  • I don't think you can. Google have opted to only include a subset of the Java API with Android, so you can't really use libraries that require more than that. – Mark Rotteveel Dec 07 '18 at 14:57

0 Answers0