带有Java 9 java.lang.NoClassDefFoundError的Oracle JDBC驱动程序:无法初始化类oracle.jdbc.OracleDriver

瑞安

我正在尝试使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中运行时,所有其他.jars都已正确加载。有人在Java 9+上运行Oracle jdbc驱动程序有幸吗?

瑞安

因此,一旦我为DriverManager启用跟踪日志记录,问题就会最终显现出来。Sybase的旧jconn驱动程序与Java 9/10发生冲突,并导致DriverManager出错。既然现在已经不赞成使用该驱动程序,那是有道理的。

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章