Forum Discussion

Lavalyte's avatar
Lavalyte
Occasional Contributor
8 years ago
Solved

can't register JDCB driver class

 

When using SoapUI Opensource;

 

I have a mock server groovy script that is attempting to access a sql server database.

My soapUI installation has a valid sqljdbc4.jar file in /ext directory.

 

My groovy script contains

 

Class.forName("com.microsoft.sqlserver.jdbc.SQLServerDriver").newInstance();

 

When I run a request that calls the mocked service I get this error:

 

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
<soapenv:Body>
<soapenv:Fault>
<faultcode>Server</faultcode>
<faultstring>Failed to dispatch using script; java.lang.ClassNotFoundException: com.microsoft.sqlserver.jdbc.SQLServerDriver</faultstring>
</soapenv:Fault>
</soapenv:Body>
</soapenv:Envelope>

 

 

 

 

    • Hope you might copied the library under SOAPUI_HOME/bin/ext and restarted soapui.
    • It requires to register the driver using below statement in the groovy script as per the documentation
    • Of course, you need to change the driver class in below statement as well.
    com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "com.mysql.jdbc.Driver" )

     

5 Replies

  • nmrao's avatar
    nmrao
    Champion Level 3
    • Hope you might copied the library under SOAPUI_HOME/bin/ext and restarted soapui.
    • It requires to register the driver using below statement in the groovy script as per the documentation
    • Of course, you need to change the driver class in below statement as well.
    com.eviware.soapui.support.GroovyUtils.registerJdbcDriver( "com.mysql.jdbc.Driver" )

     

  • rupert_anderson's avatar
    rupert_anderson
    Valued Contributor

    Hi,

     

    When you make a request to the mock, and SoapUI starts up, you see logging in the tomcat console - can you see your jar loaded e.g. something like:

     

    [SoapUI] Adding [/Users/test/soapui-next/soapui/ext/sqljdbc4.jar] to extensions classpath

     

    Or do you see something like:

     

    WARN  [SoapUI] Missing folder [/Users/test/apache-tomcat-7.0.54/webapps/restmock/ext] for external libraries

     

    ?

     

    Regards,

    Rupert

    • Lavalyte's avatar
      Lavalyte
      Occasional Contributor

       

      To do what I wanted I had to import the sql server driver explicitely before I registered it.

       

      • nmrao's avatar
        nmrao
        Champion Level 3
        Did not get you? Are you saying or asking?