Ask a Question

[RESOLVED]jdbc driver failing from maven

DMcCabe
Contributor

[RESOLVED]jdbc driver failing from maven

hi there
I'm experiencind a jdbc connection failure 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 in another post 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?

thanks n advance
6 REPLIES 6
nmrao
Community Hero

Is runtime dependency defined in the pom.xml for the driver?


Regards,
Rao.
DMcCabe
Contributor

yes, I have it configured like this :

<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.25</version>
<scope>runtime</scope>
</dependency>

is that the correct way to do it? unfortunately, it does not make any difference
DMcCabe
Contributor

to answer my own question ....

I had the dependency in the wrong section ... it needs to be in the plugin section

<plugin>
<groupId>com.github.redfish4ktc.soapui</groupId>
<artifactId>maven-soapui-extension-plugin</artifactId>

<version>4.5.1.3</version>
<configuration>
<!--The location of your soapUI setting file-->
<projectFile>/data/servers/project.xml</projectFile>
<junitReport>true</junitReport>
<printReport>true</printReport>
<testFailIgnore>true</testFailIgnore>
</configuration>
<dependencies>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.25</version>
<scope>runtime</scope>
</dependency>
</dependencies>
</plugin>
</plugins>
nmrao
Community Hero

Hmm.. that seems to be correct. What is the repository you are referring to? You may give a try by removing the scope.


Regards,
Rao.
redfish4ktc2
Super Contributor

I confirm, the correct way to add the jdbc driver is to add dependencies to the soapui maven plugin in the pom, see http://www.soapui.org/Test-Automation/m ... ll-example
You also do not need to manually put any jar in your local repository, this done by maven when it resolves plugin dependencies

I 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.

cancel
Showing results for 
Search instead for 
Did you mean: