Ask a Question

JDBC Request step failing from maven

tobbe76
New Contributor

JDBC Request step failing from maven

I am using a JDBC request step to enter some data into the database. My tests work perfectly from within soapUI, but when I run them with the maven-plugin i get a ClassCastException:

ERROR [errorlog] com.eviware.soapui.support.SoapUIException: Failed to init connection for drvr [com.mysql.jdbc.Driver], connectionString [jdbc:mysql://127.0.0.1:3306/elp_run?createDatabaseIfNotExist=true&user=root&password=root]
com.eviware.soapui.support.SoapUIException: Failed to init connection for drvr [com.mysql.jdbc.Driver], connectionString [jdbc:mysql://127.0.0.1:3306/elp_run?createDatabaseIfNotExist=true&user=root&password=root]
at com.eviware.soapui.support.jdbc.JdbcUtils.initConnection(JdbcUtils.java:60)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.getDatabaseConnection(JdbcSubmit.java:221)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.prepare(JdbcSubmit.java:264)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.runQuery(JdbcSubmit.java:195)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.run(JdbcSubmit.java:160)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.<init>(JdbcSubmit.java:74)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcRequest.submit(JdbcRequest.java:136)
at com.eviware.soapui.impl.wsdl.teststeps.JdbcRequestTestStep.run(JdbcRequestTestStep.java:179)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runTestStep(WsdlTestCaseRunner.java:207)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:138)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:39)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:139)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)
2011-03-03 14:48:12,568 ERROR [AbstractTestRunner] Exception during Test Execution
java.lang.ClassCastException: com.eviware.soapui.config.impl.TestStepConfigImpl cannot be cast to com.eviware.soapui.config.JdbcRequestTestStepConfig
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcRequest.getRequestContent(JdbcRequest.java:103)
at com.eviware.soapui.impl.wsdl.teststeps.JdbcRequestTestStep.run(JdbcRequestTestStep.java:231)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runTestStep(WsdlTestCaseRunner.java:207)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:138)
at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.internalRun(WsdlTestCaseRunner.java:39)
at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:139)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:441)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)


Any ideas?

/Tobias
5 REPLIES 5
Bjerre
Not applicable

Re: JDBC Request step failing from maven

Sounds like the appropriate database drivers are not loaded. Try adding the relevant .jar files to the path for the maven-plugin.

Best regards,
Jakob Bjerre Jensen
Cryptomathic A/S
DMcCabe
Contributor

Re: JDBC Request step failing from maven

I'm experiencing a similar problem when running my tests via maven, (they work fine from the UI) I get the following Exception :

10:13:01,735 ERROR [SoapUI] An error occured [Failed to init connection for drvr [com.mysql.jdbc.Driver], connectionString [jdbc:mysql://vhostname/db_name?user=user&password=password]], see error log for details
com.eviware.soapui.support.SoapUIException: Failed to init connection for drvr [com.mysql.jdbc.Driver], connectionString [jdbc:mysql://jdbc:mysql://vhostname/db_name?user=user&password=password]

the error log only contains the following :

2013-07-23 10:05:10,990 ERROR [errorlog] java.sql.SQLException: No suitable driver
java.sql.SQLException: No suitable driver
at java.sql.DriverManager.getDriver(DriverManager.java:289)
at com.eviware.soapui.support.jdbc.JdbcUtils.initConnection(JdbcUtils.java:52)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.getDatabaseConnection(JdbcSubmit.java:218)
at com.eviware.soapui.impl.wsdl.panels.teststeps.JdbcSubmit.prepare(JdbcSubmit.java:261)

the correct version of the plugin was added to ~/.m2/repository but it doesn't seem to get picked up

it was mentioned to copy the .jar file of the mysql connector to the path for the maven plugin, but I don't understand what that means in this context, any suggestions please?
redfish4ktc2
Super Contributor

Re: JDBC Request step failing from maven

Answer given directly by @DMcCabe, see viewtopic.php?f=2&t=20515#p46331
As described in the documentation (see http://www.soapui.org/Test-Automation/m ... ll-example), add your jdbc dependency to the soapui plugin
zqx031
New Contributor

Re: JDBC Request step failing from maven

see the error:

 

java.lang.ClassNotFoundException: com.oracle.jdbc.Driver

 

 

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx.dsd</groupId>
<artifactId>eAPI-Tests</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>eAPI-Test</name>
<description>A project to test eAPIS</description>
<build>
<plugins>
<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-pro-maven-plugin</artifactId>
<version>5.1.1</version>
<dependencies>
<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc</artifactId>
<version>11.1.0.6.0</version>
</dependency>
<dependency>
<groupId>org.reflections</groupId>
<artifactId>reflections</artifactId>
<version>0.9.9-RC1</version>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.10-FINAL</version>
</dependency>
</dependencies>
<configuration>
<tool>wsi,axis1,axis2</tool>
<projectFile>src/test/resources</projectFile>
<junitReport>true</junitReport>
<outputFolder>target/reports</outputFolder>
<testSuite>SureSwipeTSuite</testSuite>
<settingsFile>eAPI-Tests/soapui-settings.xml</settingsFile>

</configuration>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>test</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

 

 

Thsis is my POM and it seems to fail eventhough I  gave the ODBC jar as a plugin dependency and the jar is downlaoded . I also checked the jar file has the required class.

rupert_anderson
Valued Contributor

Re: JDBC Request step failing from maven

Hi,

 

It sounds like you only need to add your DB driver jar to the external libraries (ext folder) that Maven expects. Did you see a message like this at the maven script is run:

 

16:28:15,343 WARN [SoapUI] Missing folder [.../ext] for external libraries

 

?

 

If so either add the db driver jar file to this location or alternatively specify the location of the 'ext' folder (containing the db driver jar) with the following parameter:

 

mvn integration-test "-Dsoapui.ext.libraries=src/test/resources"

 

Hope this helps,

Cheers,

Rupert

Author of SoapUI Cookbook
cancel
Showing results for 
Search instead for 
Did you mean: