简体   繁体   中英

Using ojdbc with SoapUI's maven plugin

I have faced a problem and I have no idea what's going on, so I decided to ask for help. I'm using SoapUI's plugin for Maven, got this in my pom.xml:

<plugin>
<groupId>com.smartbear.soapui</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<version>4.6.1</version>
...
</plugin>

I also have the ojdbc dependency in pom.xml, like this:

<dependency>
<groupId>com.oracle</groupId>
<artifactId>ojdbc6</artifactId>
<version>11.2.0.3</version>
</dependency>

And I have a test step in groovy, like this:

import java.sql.*;
def path="jdbc:oracle:thin:@xxxxxxxxxxxxx"
def username='xxxxx'
def password='xxxxx'
Connection conn = DriverManager.getConnection(path, username, password)    /// Error here.

I have included the same ojdbc6.jar in my SoapUI's project. The same files - in Maven project and in SoapUI. My question is: Why am I getting java.sql.SQLException: No suitable driver found for jdbc:oracle:thin:@xxxxxxxxxx using Maven? When I run it in SoapUI everything is working properly, no errors, no exceptions... Help would be really appreciated!

You need to define the JDBC dependency in the plugin, not the project:

        <plugin>
            <groupId>com.smartbear.soapui</groupId>
            <artifactId>soapui-pro-maven-plugin</artifactId>
            <version>4.6.1</version>
            <configuration>
                <projectFile>...</projectFile>
                ...
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>com.oracle</groupId>
                    <artifactId>ojdbc6</artifactId>
                    <version>11.2.0.3</version>
                </dependency>
            </dependencies>
        </plugin>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM