Friday, January 8, 2010

Android development: trying to use derbyclient.jar, but failing due to javax.naming not present.

I tried to take a fairly large next step in my Android development: I tried to use derbyclient.jar in my application.

The idea was that I wanted to write an Android application which created a JDBC connection to a Derby database served by the Derby network server on some other machine, and then I would use JDBC calls to access data from that Derby server over the network.

So, I:

  • Added derbyclient.jar to the libs directory of my sample application

  • Imported java.sql.DriverManager and java.sql.Connection into my HelloAndroid.java class

  • Tried to call DriverManager.getConnection



My application crashed.


Sorry!

The application HelloAndroid (process com.example.helloandroid) has stopped unexpectedly. Please try again.


So I searched around for a while, and found adb logcat, and ran that and re-directed the output to a file so I could look through it.

In the logcat output, I found this:


I/dalvikvm( 348): Failed resolving Lorg/apache/derby/jdbc/ClientBaseDataSource;
interface 212 'Ljavax/naming/Referenceable;'


I see in the Android docs that, indeed, javax.naming is not listed as a supported package.

And, unfortunately, references to javax.naming exist in a number of places in the Derby source, so this is kind of a significant problem.

I'm not quite sure what to do next, but for now I posted this finding to DERBY-4458 since that seemed like a reasonable place to track the info.

We'll see if anybody posts any suggestions there.

1 comment:

  1. This document explains how to repackage the missing javax libraries in Android:http://code.google.com/p/dalvik/wiki/JavaxPackages

    ReplyDelete