SoapUI + sqlite-jdbc = ClassNotFoundException
我想在 SoapUI Groovy 脚本中使用 SQLite 数据库。
我已将库 sqlitejdbc-v056.jar 复制到 SoapUI 的 /bin/ext 目录(理论上是 SoapUI 类路径),并且像这样使用它:
import groovy.sql.Sql
def sql = Sql.newInstance( "jdbc:sqlite:/path_to_database", "org.sqlite.JDBC" )
当我运行 MockService 时,我得到以下异常:
java.sql.SQLException: No suitable driver found for jdbc:sqlite:/path_to_database
当我使用 Class.forName("org.sqlite.JDBC") 时,我得到另一个异常:
java.lang.ClassNotFOundException: org.sqlite.JDBC
两种方法在 groovyConsole 中都工作正常。
我怎样才能让它们在 SoapUI 中工作?
I'd like to use SQLite database in SoapUI Groovy script.
I have copied the library sqlitejdbc-v056.jar into SoapUI's /bin/ext directory (theoretically SoapUI classpath) and I use it like this:
import groovy.sql.Sql
def sql = Sql.newInstance( "jdbc:sqlite:/path_to_database", "org.sqlite.JDBC" )
When I run the MockService i get the following exception:
java.sql.SQLException: No suitable driver found for jdbc:sqlite:/path_to_database
When I use Class.forName("org.sqlite.JDBC") i get another exception:
java.lang.ClassNotFOundException: org.sqlite.JDBC
Both methods work fine in groovyConsole.
How can I make them work in SoapUI?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
好的,我找到了答案。
除了将库 .jar 文件复制到soapui/bin/ext 之外,您还需要
在使用 groovy.sql.Sql 之前在代码中添加:
Ok, I found the answer.
Apart from copying the library .jar file to soapui/bin/ext you need to add:
in your code before using groovy.sql.Sql.