gpt4 book ai didi

java - Oracle JDBC 驱动程序与 Java 9 java.lang.NoClassDefFoundError : Could not initialize class oracle. jdbc.OracleDriver

转载 作者:行者123 更新时间:2023-11-30 02:08:41 47 4
gpt4 key购买 nike

我正在尝试让 Java 应用程序与 Java 9+ 一起使用。在 1.9 jre 中运行时,我得到以下堆栈跟踪:

2018-06-06 11:22:54.304 ERROR - main - Replicator - (stderr) java.lang.NoClassDefFoundError: Could not initialize class oracle.jdbc.OracleDriver
2018-06-06 11:22:54.305 ERROR - main - Replicator - (stderr)

2018-06-06 11:22:54.306 ERROR - main - Replicator - (stderr) at java.base/java.lang.Class.forName0(Native Method)
2018-06-06 11:22:54.306 ERROR - main - Replicator - (stderr)

2018-06-06 11:22:54.306 ERROR - main - Replicator - (stderr) at java.base/java.lang.Class.forName(Unknown Source)
2018-06-06 11:22:54.306 ERROR - main - Replicator - (stderr)

2018-06-06 11:22:54.306 ERROR - main - Replicator - (stderr) at java.sql/java.sql.DriverManager.isDriverAllowed(Unknown Source)
2018-06-06 11:22:54.306 ERROR - main - Replicator - (stderr)

2018-06-06 11:22:54.306 ERROR - main - Replicator - (stderr) at java.sql/java.sql.DriverManager.isDriverAllowed(Unknown Source)
2018-06-06 11:22:54.306 ERROR - main - Replicator - (stderr)

2018-06-06 11:22:54.306 ERROR - main - Replicator - (stderr) at java.sql/java.sql.DriverManager.getDrivers(Unknown Source)
2018-06-06 11:22:54.307 ERROR - main - Replicator - (stderr)

2018-06-06 11:22:54.307 ERROR - main - Replicator - (stderr) at java.sql/java.sql.DriverManager.getDrivers(Unknown Source)
2018-06-06 11:22:54.307 ERROR - main - Replicator - (stderr)

2018-06-06 11:22:54.307 ERROR - main - Replicator - (stderr) at org.apache.commons.dbcp2.BasicDataSource.<clinit>(BasicDataSource.java:77)

我已经确认类路径是准确的,因为 1. 这在 Java 8 中运行良好,2. 在 9 中运行时,所有其他 .jar 都正确加载。有人在 Java 9+ 上运行 Oracle jdbc 驱动程序有运气吗?

最佳答案

因此,一旦我打开 DriverManager 的跟踪日志记录,问题就会自行显现。 Sybase 的旧 jconn 驱动程序与 Java 9/10 冲突并导致 DriverManager 出错。鉴于它现在是一个已弃用的驱动程序,这是有道理的。

关于java - Oracle JDBC 驱动程序与 Java 9 java.lang.NoClassDefFoundError : Could not initialize class oracle. jdbc.OracleDriver,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50727309/

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