Maven + SoapUI ClassNotFoundException(com.microsoft.sqlserver.jdbc.SQLServerDriver)

时间:2017-09-20 09:53:02

标签: maven groovy soapui pom.xml

需要Maven和SoapUI的一点帮助。长期计划是将我的SoapUI测试与Jenkins集成,然而,当我让我的测试与Maven一起运行时,我很遗憾地陷入了第一道障碍。每当我在命令行上通过maven运行我的SoapUI测试时,我都会收到以下错误:

  

2017-09-20 10:03:06,977错误[errorlog]   抛出java.lang.ClassNotFoundException:   com.microsoft.sqlserver.jdbc.SQLServerDriver   抛出java.lang.ClassNotFoundException:   com.microsoft.sqlserver.jdbc.SQLServerDriver at   org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)   在   org.codehaus.plexus.classworlds.realm.ClassRealm.unsynchronizedLoadClass(ClassRealm.java:271)   在   org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:247)   在   org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:239)   at java.lang.Class.forName0(Native Method)at   java.lang.Class.forName(Class.java:264)at   groovy.sql.Sql.loadDriver(Sql.java:701)at   groovy.sql.Sql.newInstance(Sql.java:483)at   groovy.sql.Sql $ newInstance.call(未知来源)at   org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)   在   org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:108)   在   org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:120)   在Script1.run(Script1.groovy:13)at   com.eviware.soapui.support.scripting.groovy.SoapUIGroovyScriptEngine.run(SoapUIGroovyScriptEngine.java:100)   在   com.eviware.soapui.impl.wsdl.teststeps.WsdlGroovyScriptTestStep.run(WsdlGroovyScriptTestStep.java:154)   在   com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:239)   在   com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:52)   在   com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:152)   在   com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:47)   在   com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:139)   在   java.util.concurrent.Executors $ RunnableAdapter.call(Executors.java:511)   在java.util.concurrent.FutureTask.run(FutureTask.java:266)at   java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)   在   java.util.concurrent.ThreadPoolExecutor中的$ Worker.run(ThreadPoolExecutor.java:617)   在java.lang.Thread.run(Thread.java:745)

现在,据我所知,我已经包含了所有必要的依赖项。这是我的pom文件的副本。这是一个简单的,我从互联网借来并调整了通常的位。

<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.smartbear.samples</groupId>
<artifactId>soapui-maven-plugin</artifactId>
<packaging>jar</packaging>
<version>1.0-SNAPSHOT</version>
<name>Maven 2 SoapUI Sample</name>
<url>http://maven.apache.org</url>
<pluginRepositories>
    <pluginRepository>
        <id>SmartBearPluginRepository</id>
        <url>http://www.soapui.org/repository/maven2/</url>
    </pluginRepository>
</pluginRepositories>
<build>
    <plugins>
        <plugin>
            <groupId>com.smartbear.soapui</groupId>
            <artifactId>soapui-maven-plugin</artifactId>
            <version>5.0.0</version>
            <configuration>
            <outputFolder>logs</outputFolder>
            <printReport>true</printReport>
            <junitReport>true</junitReport>
              <projectFile>test-testing-test-Service-API-soapui-project.xml</projectFile>
            </configuration> 
            <dependencies>
                <dependency>
                    <groupId>mysql</groupId>
                    <artifactId>mysql-connector-java</artifactId>
                    <version>5.1.31</version>
                </dependency>
            </dependencies>    
            <executions>
                <execution>
                    <phase>test</phase>
                    <goals>
                        <goal>test</goal>
                    </goals>                             
                </execution>
            </executions>
        </plugin>
    </plugins>
</build>
</project>

有人能发现我犯的任何明显错误吗?我错过了什么吗?在Maven / SoapUI中是否有一些我不知道的设置/配置?

1 个答案:

答案 0 :(得分:2)

他搜索sqlserver依赖

<dependency>
        <groupId>com.microsoft.sqlserver</groupId>
        <artifactId>mssql-jdbc</artifactId>
        <version>{version}</version>
    </dependency>

但在pom文件中找到了mysql依赖