Forum Discussion

sunxiucui's avatar
sunxiucui
New Contributor
13 years ago

Run Project in command line, JDBC driver not found

Hi,
I ran my soapUI Project in command line(testrunner.bat XXX.xml). in the TearDown Script, I try to conect to MS SQL server, however, it always pops up JDBC Driver not found exeption.
But in GUI mode, the script runs smoothly. Is there some restrictions in command line mode?


Thanks very much
  • scassel_1's avatar
    scassel_1
    New Contributor
    Hi

    After some %?&#@ I found out that testrunner.bat must be executed from the bin directory _or_ I have to add CD command before execute the bat:

    cd "C:\Program Files (x86)\SmartBear\soapUI-4.5.0\bin"
    testrunner.bat -sxxxxxx -cxxxxxx C:\Projects\xxxxxx\SoapUI\xxxxx---Outbound-soapui-project.xml

    Hope this helps
    Stephan
  • scassel_1's avatar
    scassel_1
    New Contributor
    Or even better:

    "%soapui_bin%testrunner.bat" [...............]

    soapui_bin is a System variable pointing at the soapui bin directory

    Stephan
  • r3nrut's avatar
    r3nrut
    Occasional Contributor
    I've tried the direct path to testrunner.bat approach and I'm still receiving the error. Did this fix the problem for anyone else? I'm using soapUI Pro 4.5.

    Thanks!
  • I have also tried running the batch file from within the bin dir, and still the JDBC driver is not found.

    Can we define the JDBC connection as a project property, using the -P option, etc?
    Should Smartbear add a command line option to Testrunner.bat for pointing to the JDBC?

    We need to solve this issue.
  • A. On Windows

    The solution is to specify a path to the JDBC driver in the CLASSPATH in soapui-pro.bat in C:\Program Files (x86)\SmartBear\soapUI-Pro-4.5.1\bin, as follows:

    set CLASSPATH=%SOAPUI_HOME%soapui-pro-4.5.1.jar;%SOAPUI_HOME%..\lib\*;%SOAPUI_HOME/bin/ext/sqljdbc4.jar

    B. On Linux:
    try to edit soapui-pro.sh. Just add this line to the end of soapui_classpath:
    SOAPUI_CLASSPATH=$SOAPUI_CLASSPATH:$SOAPUI_HOME/bin/ext/ojdbc14.jar


    C.
    You also should be able to change environments and point to different instances of DB connection strings and drivers, using scripts as follows:

    def env = project.getPropertyValue("EnvironmentVar")

    log.info "Environment param = " + project.getPropertyValue("EnvironmentVar")
    log.info "Pointing to environment = " + project.getActiveEnvironmentName()
    if (env != null && env != "") {
    project.setActiveEnvironment(env)
    log.info "Now Pointing to environment = " + project.getActiveEnvironmentName()
    }

    Or by including the following in your groovy script:

    com.eviware.soapui.support.GroovyUtils.registerJdbcDriver("org.sqlite.JDBC")


    Thanks,