错误 [SoapUI] 发生错误 [找不到适合 jdbc:oracle:thin 的驱动程序:@//174.23.0.187:1111/qwe]
ERROR [SoapUI] An error occurred [No suitable driver found for jdbc:oracle:thin:@//174.23.0.187:1111/qwe]
将 maven 插件更新到版本 5.1.2 后,我收到一条错误消息
$ERROR [SoapUI] An error occurred [No suitable driver found for jdbc:oracle:thin:@//174.23.0.187:1111/qwe], see error log for details
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//174.23.0.187:1111/qwe
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at groovy.sql.Sql.newInstance(Sql.java:398)
at groovy.sql.Sql.newInstance(Sql.java:442)
at groovy.sql.Sql$newInstance.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
...
您需要将 oracle jdbc 驱动程序包含到您的类路径中,您可以从 here
下载
既然你有一个 maven 项目,最正常的做法就是简单地在你的 pom.xml
中包含依赖项,但是由于 oracle jdbc 许可证,没有 public 这个 jar 的存储库,但是最近(几天前)oracle 将这个 jar 添加到他们的存储库中。您可以按照 oracle blog 上的详细信息尝试使用它(请注意,需要用户身份验证和 maven 版本 3.2.5 o 更高)。
如果您不想使用 密码锁定 Oracle 存储库,您可以执行以下操作:
从 Oracle 下载 O-JDBC。
将其放入您的项目中。某个地方,比如 lib
目录。
使用 maven-install-plugin
在您的本地存储库中安装 jar。像这样:
<plugin>
<artifactId>maven-install-plugin</artifactId>
<version>2.4</version>
<executions>
<execution>
<id>install-ojdbc7</id>
<phase>pre-integration-test</phase>
<configuration>
<file>lib/ojdbc7.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2.0</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>
有关其工作原理的详细信息将进一步讨论 here。
对于您的 SoapUI,您需要 link 在依赖项中:
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>${soapui-maven-plugin.version}</version>
<dependencies>
<dependency>
<groupId>oracle.jdbc</groupId>
<artifactId>ojdbc7</artifactId>
<version>12.1.0.2.0</version>
</dependency>
</dependencies>
<executions>
<execution>
<phase>integration-test</phase>
<goals>
<goal>test</goal>
</goals>
<configuration>
...
</configuration>
</execution>
</executions>
</plugin>
我正在使用 mvn verify
来 运行 这一切。
注册JDBC驱动解决了问题
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "oracle.jdbc.OracleDriver" )
将 maven 插件更新到版本 5.1.2 后,我收到一条错误消息
$ERROR [SoapUI] An error occurred [No suitable driver found for jdbc:oracle:thin:@//174.23.0.187:1111/qwe], see error log for details
java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@//174.23.0.187:1111/qwe
at java.sql.DriverManager.getConnection(DriverManager.java:596)
at java.sql.DriverManager.getConnection(DriverManager.java:215)
at groovy.sql.Sql.newInstance(Sql.java:398)
at groovy.sql.Sql.newInstance(Sql.java:442)
at groovy.sql.Sql$newInstance.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
...
您需要将 oracle jdbc 驱动程序包含到您的类路径中,您可以从 here
下载既然你有一个 maven 项目,最正常的做法就是简单地在你的 pom.xml
中包含依赖项,但是由于 oracle jdbc 许可证,没有 public 这个 jar 的存储库,但是最近(几天前)oracle 将这个 jar 添加到他们的存储库中。您可以按照 oracle blog 上的详细信息尝试使用它(请注意,需要用户身份验证和 maven 版本 3.2.5 o 更高)。
如果您不想使用 密码锁定 Oracle 存储库,您可以执行以下操作:
从 Oracle 下载 O-JDBC。
将其放入您的项目中。某个地方,比如
lib
目录。使用
maven-install-plugin
在您的本地存储库中安装 jar。像这样:<plugin> <artifactId>maven-install-plugin</artifactId> <version>2.4</version> <executions> <execution> <id>install-ojdbc7</id> <phase>pre-integration-test</phase> <configuration> <file>lib/ojdbc7.jar</file> <repositoryLayout>default</repositoryLayout> <groupId>oracle.jdbc</groupId> <artifactId>ojdbc7</artifactId> <version>12.1.0.2.0</version> <packaging>jar</packaging> <generatePom>true</generatePom> </configuration> <goals> <goal>install-file</goal> </goals> </execution> </executions> </plugin>
有关其工作原理的详细信息将进一步讨论 here。
对于您的 SoapUI,您需要 link 在依赖项中:
<plugin> <groupId>com.smartbear.soapui</groupId> <artifactId>soapui-maven-plugin</artifactId> <version>${soapui-maven-plugin.version}</version> <dependencies> <dependency> <groupId>oracle.jdbc</groupId> <artifactId>ojdbc7</artifactId> <version>12.1.0.2.0</version> </dependency> </dependencies> <executions> <execution> <phase>integration-test</phase> <goals> <goal>test</goal> </goals> <configuration> ... </configuration> </execution> </executions> </plugin>
我正在使用
mvn verify
来 运行 这一切。
注册JDBC驱动解决了问题
com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "oracle.jdbc.OracleDriver" )