Durgesh
Durgesh

Reputation: 595

SoapUI maven execution results NoClassDefFoundError: com/jniwrapper/PlatformContext

I am running SOAP UI test case by Junit and which is Java-Maven Project. When I hit the command mvn clean test, getting below error

15:49:44,469 ERROR [AbstractTestRunner] Exception during Test Execution
java.lang.NoClassDefFoundError: com/jniwrapper/PlatformContext
    at com.eviware.soapui.SoapUI.isJXBrowserDisabled(SoapUI.java:1025)
    at com.eviware.soapui.SoapUI.isJXBrowserDisabled(SoapUI.java:1006)
    at com.eviware.soapui.impl.wsdl.submit.filters.HttpAuthenticationRequestFilter.filterAbstractHttpRequest(HttpAuthenticationRequestFilter.java:83)
    at com.eviware.soapui.impl.wsdl.submit.filters.AbstractRequestFilter.filterRequest(AbstractRequestFilter.java:31)
    at com.eviware.soapui.impl.wsdl.submit.transports.http.HttpClientRequestTransport.sendRequest(HttpClientRequestTransport.java:179)
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.run(WsdlSubmit.java:123)
    at com.eviware.soapui.impl.wsdl.WsdlSubmit.submitRequest(WsdlSubmit.java:76)
    at com.eviware.soapui.impl.wsdl.WsdlRequest.submit(WsdlRequest.java:238)
    at com.eviware.soapui.impl.wsdl.teststeps.WsdlTestRequestStep.run(WsdlTestRequestStep.java:417)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.runTestStep(AbstractTestCaseRunner.java:235)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCaseRunner.runCurrentTestStep(WsdlTestCaseRunner.java:48)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:148)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestCaseRunner.internalRun(AbstractTestCaseRunner.java:43)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.run(AbstractTestRunner.java:135)
    at com.eviware.soapui.impl.wsdl.support.AbstractTestRunner.start(AbstractTestRunner.java:77)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:640)
    at com.eviware.soapui.impl.wsdl.testcase.WsdlTestCase.run(WsdlTestCase.java:73)
    at learn.TestCaseTwo.testRunnerFive(TestCaseTwo.java:129)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:108)
    at org.testng.internal.Invoker.invokeMethod(Invoker.java:661)
    at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:869)
    at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1193)
    at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:126)
    at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:109)
    at org.testng.TestRunner.privateRun(TestRunner.java:744)
    at org.testng.TestRunner.run(TestRunner.java:602)
    at org.testng.SuiteRunner.runTest(SuiteRunner.java:380)
    at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:375)
    at org.testng.SuiteRunner.privateRun(SuiteRunner.java:340)
    at org.testng.SuiteRunner.run(SuiteRunner.java:289)
    at org.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:52)
    at org.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:86)
    at org.testng.TestNG.runSuitesSequentially(TestNG.java:1301)
    at org.testng.TestNG.runSuitesLocally(TestNG.java:1226)
    at org.testng.TestNG.runSuites(TestNG.java:1144)
    at org.testng.TestNG.run(TestNG.java:1115)
    at org.apache.maven.surefire.testng.TestNGExecutor.run(TestNGExecutor.java:77)
    at org.apache.maven.surefire.testng.TestNGDirectoryTestSuite.execute(TestNGDirectoryTestSuite.java:110)
    at org.apache.maven.surefire.testng.TestNGProvider.invoke(TestNGProvider.java:106)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.apache.maven.surefire.util.ReflectionUtils.invokeMethodWithArray(ReflectionUtils.java:189)
    at org.apache.maven.surefire.booter.ProviderFactory$ProviderProxy.invoke(ProviderFactory.java:165)
    at org.apache.maven.surefire.booter.ProviderFactory.invokeProvider(ProviderFactory.java:85)
    at org.apache.maven.surefire.booter.ForkedBooter.runSuitesInProcess(ForkedBooter.java:115)
    at org.apache.maven.surefire.booter.ForkedBooter.main(ForkedBooter.java:75)

Below is my pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<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>net.wu.web</groupId>
<artifactId>bddcucumber</artifactId>
<version>1.0-SNAPSHOT</version>

<properties>
    <skipITTests>false</skipITTests>
    <geb.version>0.10.0</geb.version>
    <selenium.version>2.52.0</selenium.version>
    <groovy.version>2.3.6</groovy.version>
    <spock.version>0.7-groovy-2.0</spock.version>
    <gson.version>2.3.1</gson.version>
    <httpclient.version>4.3.4</httpclient.version>
    <httpcore.version>4.3.2</httpcore.version>
    <surefire.plugin.version>2.12.4</surefire.plugin.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>

<repositories>
    <repository>
        <id>soapUI</id>
        <name>eviware</name>
        <url>http://smartbearsoftware.com/repository/maven2/</url>
    </repository>
</repositories>

<pluginRepositories>
    <pluginRepository>
        <id>eviwarePluginRepository</id>
        <url>http://smartbearsoftware.com/repository/maven2/</url>
    </pluginRepository>
</pluginRepositories>

<dependencies>


    <dependency>
        <groupId>commons-collections</groupId>
        <artifactId>commons-collections</artifactId>
        <version>3.2.2</version>
    </dependency>

    <!-- https://mvnrepository.com/artifact/junit/junit -->
    <dependency>
        <groupId>junit</groupId>
        <artifactId>junit</artifactId>
        <version>4.12</version>
        <scope>test</scope>
    </dependency>

    <dependency>
        <groupId>org.testng</groupId>
        <artifactId>testng</artifactId>
        <version>6.11</version>
        <scope>test</scope>
    </dependency>



    <dependency>
        <groupId>fife</groupId>
        <artifactId>rsyntaxtextarea</artifactId>
        <version>2.0.1</version>
    </dependency>

    <!--Reference URL :  https://stackoverflow.com/questions/22908086/how-to-run-soapui-tests-from-java-resolved -->
    <dependency>
        <groupId>com.github.redfish4ktc.soapui</groupId>
        <artifactId>maven-soapui-extension-plugin</artifactId>
        <version>4.6.4.0</version>
    </dependency>

    <dependency>
        <groupId>net.java.dev.jgoodies</groupId>
        <artifactId>looks</artifactId>
        <version>2.1.4</version>
    </dependency>
    <dependency>
        <groupId>net.sf.squirrel-sql.thirdparty-non-maven</groupId>
        <artifactId>com-fifesoft-rsyntaxtextarea</artifactId>
        <version>1.0.0</version>
    </dependency>
    <dependency>
        <groupId>org.apache.karaf.eik.plugins</groupId>
        <artifactId>org.apache.commons.collections</artifactId>
        <version>3.2.1</version>
    </dependency>


</dependencies>



<build>
    <plugins>


        <!-- Maven Surefire plugin-->
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-surefire-plugin</artifactId>
            <version>${surefire.plugin.version}</version>
        </plugin>


        <plugin>
            <!--<groupId>eviware</groupId>-->
            <groupId>com.smartbear.soapui</groupId>
            <artifactId>soapui-pro-maven-plugin</artifactId>
            <version>5.1.2</version>
            <configuration>

                <outputFolder>${basedir}/target/surefire-reports</outputFolder>
                <junitReport>true</junitReport>
                <printReport>true</printReport>

            </configuration>

        </plugin>

    </plugins>

</build>

Below is my test case.

public class TestCaseTwo {

    WsdlProjectPro project = new WsdlProjectPro("src\\test\\resources\\SOAP\\Spain_KYC_CS_Sanity-soapui-project.xml");
    TestSuite testSuite;
    TestCase testCase;
    TestRunner testRunner;

    @Test
    public void testRunnerOne(){
        testSuite = project.getTestSuiteByName("Registration");
        testCase = testSuite.getTestCaseByName("Registar a new D Type user");

        testRunner = testCase.run(new PropertiesMap(),false);
        Assert.assertEquals(testRunner.getStatus(), TestRunner.Status.FINISHED);
    }
}

Can you please help me to remove this Error: java.lang.NoClassDefFoundError: com/jniwrapper/PlatformContext

Upvotes: 0

Views: 442

Answers (1)

Rao
Rao

Reputation: 21379

Add system argument soapui.jxbrowser.disable and value as true

For example adding in the command-line of maven

mvn clean -Dsoapui.jxbrowser.disable=true

Upvotes: 1

Related Questions