我正在设计一个Android应用程序,使用开源的jtds驱动程序版本1.2.7直接连接到azure数据库。我已经成功连接到sql server express数据库,所以我知道它有效。但是,当尝试连接到azure数据库时,我收到错误。这是堆栈跟踪:
06-06 17:03:49.881: E/AndroidRuntime(1906): FATAL EXCEPTION: AsyncTask #2
06-06 17:03:49.881: E/AndroidRuntime(1906): java.lang.RuntimeException: An error occured while executing doInBackground()
06-06 17:03:49.881: E/AndroidRuntime(1906): at android.os.AsyncTask$3.done(AsyncTask.java:299)
06-06 17:03:49.881: E/AndroidRuntime(1906): at java.util.concurrent.FutureTask.finishCompletion(FutureTask.java:352)
06-06 17:03:49.881: E/AndroidRuntime(1906): at java.util.concurrent.FutureTask.setException(FutureTask.java:219)
06-06 17:03:49.881: E/AndroidRuntime(1906): at java.util.concurrent.FutureTask.run(FutureTask.java:239)
06-06 17:03:49.881: E/AndroidRuntime(1906): at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:230)
06-06 17:03:49.881: E/AndroidRuntime(1906): at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
06-06 17:03:49.881: E/AndroidRuntime(1906): at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
06-06 17:03:49.881: E/AndroidRuntime(1906): at java.lang.Thread.run(Thread.java:856)
06-06 17:03:49.881: E/AndroidRuntime(1906): Caused by: java.lang.NoClassDefFoundError: com.sun.net.ssl.SSLContext
06-06 17:03:49.881: E/AndroidRuntime(1906): at net.sourceforge.jtds.ssl.SocketFactoriesSUN$TdsTlsSocketFactory.factory(SocketFactoriesSUN.java:174)
06-06 17:03:49.881: E/AndroidRuntime(1906): at net.sourceforge.jtds.ssl.SocketFactoriesSUN$TdsTlsSocketFactory.getFactory(SocketFactoriesSUN.java:157)
06-06 17:03:49.881: E/AndroidRuntime(1906): at net.sourceforge.jtds.ssl.SocketFactoriesSUN$TdsTlsSocketFactory.createSocket(SocketFactoriesSUN.java:86)
06-06 17:03:49.881: E/AndroidRuntime(1906): at net.sourceforge.jtds.jdbc.SharedSocket.enableEncryption(SharedSocket.java:332)
06-06 17:03:49.881: E/AndroidRuntime(1906): at net.sourceforge.jtds.jdbc.TdsCore.negotiateSSL(TdsCore.java:554)
06-06 17:03:49.881: E/AndroidRuntime(1906): at net.sourceforge.jtds.jdbc.ConnectionJDBC2.<init>(ConnectionJDBC2.java:350)
06-06 17:03:49.881: E/AndroidRuntime(1906): at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:188)
06-06 17:03:49.881: E/AndroidRuntime(1906): at java.sql.DriverManager.getConnection(DriverManager.java:175)
06-06 17:03:49.881: E/AndroidRuntime(1906): at java.sql.DriverManager.getConnection(DriverManager.java:209)
看起来问题是java.lang.NoClassDefFoundError: com.sun.net.ssl.SSLContext
,但我不知道该怎么做。我相信强制加密是在数据库中打开的,但我没有设置它,我没有权限搞乱这些设置。知道如何处理这个错误吗?