gpt4 book ai didi

java - 致命异常 : main java. lang.VerifyError : net. sourceforge.jtds.jdbc.TdsCore

转载 作者:塔克拉玛干 更新时间:2023-11-02 23:43:21 24 4
gpt4 key购买 nike

在我的 Android 项目中,我使用 jtds.jdbc 连接到 SQL Server 数据库。在尝试连接时,我写了错误的连接字符串,引发了一条错误消息:“Network error IOException: Connection timed out”。

       Class.forName("net.sourceforge.jtds.jdbc.Driver").newInstance();

Connection DbConn = DriverManager.getConnection(192.168.xx.xx:1085/SomeDatabase;integratedSecurity=true;user=xxx;password=xxx;instanceName=SomeInstance);

Statement stmt = DbConn.createStatement();
ResultSet reset = stmt.executeQuery(" select * from SomeTable");

Log.i("RESULTS", reset.getString(1));

DbConn.close();

这证明 JTDS 已包含在我的项目中并且正在运行。但是当我编写正确的连接字符串时,出现以下错误:

11-28 08:09:31.929: I/dalvikvm(13041): Could not find method org.ietf.jgss.GSSManager.getInstance, referenced from method net.sourceforge.jtds.jdbc.TdsCore.createGssToken
11-28 08:09:31.929: W/dalvikvm(13041): VFY: unable to resolve static method 7980: Lorg/ietf/jgss/GSSManager;.getInstance ()Lorg/ietf/jgss/GSSManager;
11-28 08:09:31.929: D/dalvikvm(13041): VFY: replacing opcode 0x71 at 0x0001
11-28 08:09:31.929: D/dalvikvm(13041): VFY: dead code 0x0004-0090 in Lnet/sourceforge/jtds/jdbc/TdsCore;.createGssToken ()[B
11-28 08:09:31.949: I/dalvikvm(13041): Could not find method org.ietf.jgss.GSSContext.initSecContext, referenced from method net.sourceforge.jtds.jdbc.TdsCore.sendGssToken
11-28 08:09:31.949: W/dalvikvm(13041): VFY: unable to resolve interface method 7974: Lorg/ietf/jgss/GSSContext;.initSecContext ([BII)[B
11-28 08:09:31.949: D/dalvikvm(13041): VFY: replacing opcode 0x72 at 0x0008
11-28 08:09:31.949: W/dalvikvm(13041): VFY: unable to resolve exception class 1082 (Lorg/ietf/jgss/GSSException;)
11-28 08:09:31.949: W/dalvikvm(13041): VFY: unable to find exception handler at addr 0x4c
11-28 08:09:31.949: W/dalvikvm(13041): VFY: rejected Lnet/sourceforge/jtds/jdbc/TdsCore;.sendGssToken ()V
11-28 08:09:31.949: W/dalvikvm(13041): VFY: rejecting opcode 0x0d at 0x004c
11-28 08:09:31.949: W/dalvikvm(13041): VFY: rejected Lnet/sourceforge/jtds/jdbc/TdsCore;.sendGssToken ()V
11-28 08:09:31.949: W/dalvikvm(13041): Verifier rejected class Lnet/sourceforge/jtds/jdbc/TdsCore;
11-28 08:09:31.949: D/AndroidRuntime(13041): Shutting down VM
11-28 08:09:31.949: W/dalvikvm(13041): threadid=1: thread exiting with uncaught exception (group=0x40018560)
11-28 08:09:32.189: E/AndroidRuntime(13041): FATAL EXCEPTION: main
11-28 08:09:32.189: E/AndroidRuntime(13041): java.lang.VerifyError: net.sourceforge.jtds.jdbc.TdsCore
11-28 08:09:32.189: E/AndroidRuntime(13041): at net.sourceforge.jtds.jdbc.JtdsConnection.<init>(JtdsConnection.java:359)
11-28 08:09:32.189: E/AndroidRuntime(13041): at net.sourceforge.jtds.jdbc.Driver.connect(Driver.java:184)
11-28 08:09:32.189: E/AndroidRuntime(13041): at java.sql.DriverManager.getConnection(DriverManager.java:180)
11-28 08:09:32.189: E/AndroidRuntime(13041): at java.sql.DriverManager.getConnection(DriverManager.java:145)
11-28 08:09:32.189: E/AndroidRuntime(13041): at fip.cis.k.PostavkeActivity$1.onClick(PostavkeActivity.java:50)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.view.View.performClick(View.java:2501)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.view.View$PerformClick.run(View.java:9107)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.os.Handler.handleCallback(Handler.java:587)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.os.Handler.dispatchMessage(Handler.java:92)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.os.Looper.loop(Looper.java:130)
11-28 08:09:32.189: E/AndroidRuntime(13041): at android.app.ActivityThread.main(ActivityThread.java:3835)
11-28 08:09:32.189: E/AndroidRuntime(13041): at java.lang.reflect.Method.invokeNative(Native Method)
11-28 08:09:32.189: E/AndroidRuntime(13041): at java.lang.reflect.Method.invoke(Method.java:507)
11-28 08:09:32.189: E/AndroidRuntime(13041): at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:858)
11-28 08:09:32.189: E/AndroidRuntime(13041): at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
11-28 08:09:32.189: E/AndroidRuntime(13041): at dalvik.system.NativeStart.main(Native Method)

我的 jtds-1.3.1.jar 在 libs 文件夹和 Android Private Libraries 中,并选中了 Order and Export。

GSSManager 是一个来自 Java 的类。但我确实在构建中包含了 jre7。

我试过:

  • 构建路径的所有技巧
  • 更改 java compilance 级别

有什么建议吗?

编辑:在 org.ietf.jgss.GSSManager 和 net.sourceforge.jrds.jdbc.TdsCore 类中都可以找到 sendGssToken() 方法

最佳答案

我刚用了一个 eariler jar ,它起作用了。

关于java - 致命异常 : main java. lang.VerifyError : net. sourceforge.jtds.jdbc.TdsCore,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20260299/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com