我在 Intellij 中向 gradle 项目添加了一个 ojdbc14 jar 文件,当使用 Intellij 中的运行选项触发测试用例时,我的测试脚本(包括 db 验证)运行良好。但是,当使用 jenkins 通过 CI 触发时,相同的测试脚本会失败,并给我以下错误
Feature: 3D secure code scenarios
java.lang.ClassNotFoundException: oracle.jdbc.driver.OracleDriver
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:190)
at util.OracleDBService.createDriver(OracleDBService.java:88)
at util.OracleDBService.openConnection(OracleDBService.java:56)
at util.OracleDBService.executeQuery(OracleDBService.java:13)
at pages.DBListOfQuery.getOrderStatusFromDB(DBListOfQuery.java:67)
at steps.FlowScenarioSteps.verify_the_order_placed_for_order_id_and_validate_order_xml(FlowScenarioSteps.java:226)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at cucumber.runtime.Utils$1.call(Utils.java:34)
at cucumber.runtime.Timeout.timeout(Timeout.java:13)
at cucumber.runtime.Utils.invoke(Utils.java:30)
我的 project.iml 文件包含 jdbc 库
<library>
<CLASSES>
<root url="jar://$USER_HOME$/Downloads/ojdbc14.jar/ojdbc14.jar!/" />
</CLASSES>
<JAVADOC />
<SOURCES />
</library>