【发布时间】:2015-06-05 17:27:16
【问题描述】:
我正在使用 SoapUI 来测试 REST/SOAP 服务。有时我需要连接到 MongoDB 并从数据库中提取一些值。
我一直在初始化数据库。
以下错误片段:
com.eviware.soapui.support.SoapUIException: Failed to init connection for driver[com.mongodb.mongo], connectionString [mongodb://<userName>:<pwd>@<domain>:<port>/<collectionName>]
我无法调用连接。
我做了什么?
- 我已经安装了mongoDB驱动“mongodb-driver-3.0.0”@“C:\Program Files\SmartBear\SoapUI-5.1.2\bin\ext”
- 下面是我尝试实现它的截图
SoapUI 日志如下:
Sun Jun 07 14:39:24 IST 2015:ERROR:An error occurred [No suitable driver], see error log for details
Sun Jun 07 14:39:24 IST 2015:ERROR:java.sql.SQLException: No suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(Unknown Source)
at com.eviware.soapui.support.jdbc.JdbcUtils.initConnection(JdbcUtils.java:51)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcRequestTestStepDesktopPanel$TestConnectionAction.actionPerformed(JdbcRequestTestStepDesktopPanel.java:616)
at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
at java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
at java.awt.Component.processMouseEvent(Unknown Source)
at javax.swing.JComponent.processMouseEvent(Unknown Source)
at java.awt.Component.processEvent(Unknown Source)
at java.awt.Container.processEvent(Unknown Source)
at java.awt.Component.dispatchEventImpl(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
at java.awt.Container.dispatchEventImpl(Unknown Source)
at java.awt.Window.dispatchEventImpl(Unknown Source)
at java.awt.Component.dispatchEvent(Unknown Source)
at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
at java.awt.EventQueue.access$200(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.awt.EventQueue$3.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.awt.EventQueue$4.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
at java.awt.EventQueue.dispatchEvent(Unknown Source)
at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at java.awt.EventDispatchThread.run(Unknown Source)
我首先看到的是无法通过 mongoDB 的驱动程序类进行连接。
【问题讨论】:
-
您是否安装了 JDBC 驱动程序?你是在属性里定义的吗?你是怎么连接的?
-
@SiKing 1. 我确实在“C:\Program Files\SmartBear\SoapUI-5.1.2\bin\ext”中安装了 JDBC 驱动程序“mongodb-driver-3.0.0”。 2. 我尝试将它添加到 SoapUI 中的 Flie > Preferences 但在那里找不到任何选项。 3. 我正在尝试通过 SoapUI 测试用例中提供的 JDBC 测试步骤连接 mongoDB。
-
我已通过 JDBC 测试步骤成功连接到 mysql。我只需要驱动程序名称即可连接到 mongodb。
标签: mongodb jdbc driver soapui