0

I am using Selenium Junit framework. Maven build was working fine, suddenly its failing due to below error. I am using latest version of WebDriverManager. Tried with older versions of webdrivermanager, still same error.

Maven command: mvn clean test exec:java -Dexec.mainClass="thig.ng.main.Test" Selenium Maven Build error -------

    java.lang.LinkageError: loader constraint violation: when resolving field "NODESET" of type javax.xml.namespace.QName, the class loader org.codehaus.mojo.exec.URLClassLoaderBuilder$ExecJavaClassLoader @7e4c0bc7 of the current class, io.github.bonigarcia.wdm.WebDriverManager, and the class loader 'bootstrap' for the field's defining class, javax.xml.xpath.XPathConstants, have different Class objects for type javax.xml.namespace.QName (io.github.bonigarcia.wdm.WebDriverManager is in unnamed module of loader org.codehaus.mojo.exec.URLClassLoaderBuilder$ExecJavaClassLoader @7e4c0bc7, parent loader 'app'; javax.xml.xpath.XPathConstants is in module java.xml of loader 'bootstrap')
        at io.github.bonigarcia.wdm.WebDriverManager.getDriversFromXml (WebDriverManager.java:1445)
        at io.github.bonigarcia.wdm.managers.ChromeDriverManager.getDriverUrls (ChromeDriverManager.java:103)
        at io.github.bonigarcia.wdm.WebDriverManager.createUrlHandler (WebDriverManager.java:1327)
        at io.github.bonigarcia.wdm.WebDriverManager.download (WebDriverManager.java:1165)
        at io.github.bonigarcia.wdm.WebDriverManager.manage (WebDriverManager.java:1083)
        at io.github.bonigarcia.wdm.WebDriverManager.setup (WebDriverManager.java:396)
        at thig.ng.main.AutomationExecutor.launchBrowser (AutomationExecutor.java:62)
        at thig.ng.model.BaseTest.launchApplication (BaseTest.java:20)
        at thig.ng.main.Transactions.transaction (Transactions.java:18)
        at thig.ng.main.Test.execute (Test.java:51)
        at thig.ng.main.Test.main (Test.java:25)
        at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:279)
        at java.lang.Thread.run (Thread.java:833)
    [INFO] ------------------------------------------------------------------------
    [INFO] BUILD FAILURE
    [INFO] ------------------------------------------------------------------------
    [INFO] Total time:  16.863 s
    [INFO] Finished at: 2022-12-05T16:46:24+05:30
    [INFO] ------------------------------------------------------------------------
    
    [ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:3.1.0:java (default-cli) on project NGAutomation: An exception occurred while executing the Java class. loader constraint violation: when resolving field "NODESET" of type javax.xml.namespace.QName, the class loader org.codehaus.mojo.exec.URLClassLoaderBuilder$ExecJavaClassLoader @7e4c0bc7 of the current class, io.github.bonigarcia.wdm.WebDriverManager, and the class loader 'bootstrap' for the field's defining class, javax.xml.xpath.XPathConstants, have different Class objects for type javax.xml.namespace.QName (io.github.bonigarcia.wdm.WebDriverManager is in unnamed module of loader org.codehaus.mojo.exec.URLClassLoaderBuilder$ExecJavaClassLoader @7e4c0bc7, parent loader 'app'; javax.xml.xpath.XPathConstants is in module java.xml of loader 'bootstrap') -> [Help 1]
    [ERROR]
    [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
    [ERROR] Re-run Maven using the -X switch to enable full debug logging.
    [ERROR]
    [ERROR] For more information about the errors and possible solutions, please read the following articles:
    [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
    
    

POM.xml

<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>NGAutomation</groupId>
    <artifactId>NGAutomation</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <build>
        <sourceDirectory>src</sourceDirectory>
        <resources>
            <resource>
                <directory>src</directory>
                <excludes>
                    <exclude>**/*.java</exclude>
                </excludes>
            </resource>
        </resources>


        <plugins>
            <plugin>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.8.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
            <scope>test</scope>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.seleniumhq.selenium/selenium-java -->
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>4.4.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.relevantcodes/extentreports -->
        <dependency>
            <groupId>com.relevantcodes</groupId>
            <artifactId>extentreports</artifactId>
            <version>2.41.2</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-core -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
            <version>2.18.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-api -->
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
            <version>2.18.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
        <!-- <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>5.2.2</version>
        </dependency> -->

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <!-- <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>5.2.2</version>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        </dependency> -->

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi</artifactId>
            <version>3.9</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.9</version>
            <exclusions>
                <exclusion>
                    <groupId>xml-apis</groupId>
                    <artifactId>xml-apis</artifactId>
                </exclusion>
            </exclusions>
        </dependency>


        <!-- https://mvnrepository.com/artifact/xml-apis/xml-apis -->
        <!--
        <dependency>
            <groupId>xml-apis</groupId>
            <artifactId>xml-apis</artifactId>
            <version>2.0.2</version>
        </dependency> -->
        <!-- https://mvnrepository.com/artifact/com.assertthat/selenium-shutterbug -->
        <dependency>
            <groupId>com.assertthat</groupId>
            <artifactId>selenium-shutterbug</artifactId>
            <version>0.9</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.thymeleaf/thymeleaf -->
        <dependency>
            <groupId>org.thymeleaf</groupId>
            <artifactId>thymeleaf</artifactId>
            <version>3.1.0.M2</version>
        </dependency>


        <!-- https://mvnrepository.com/artifact/io.github.bonigarcia/webdrivermanager -->
        <!--    <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>5.2.3</version>
        </dependency> -->

        <dependency>
            <groupId>io.github.bonigarcia</groupId>
            <artifactId>webdrivermanager</artifactId>
            <version>5.1.1</version>
        <!--    <version>5.3.1</version>-->
        </dependency>

        <!-- https://mvnrepository.com/artifact/com.paulhammant/ngwebdriver -->
        <dependency>
            <groupId>com.paulhammant</groupId>
            <artifactId>ngwebdriver</artifactId>
            <version>1.2</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.dom4j/dom4j -->
        <dependency>
            <groupId>org.dom4j</groupId>
            <artifactId>dom4j</artifactId>
            <version>2.1.3</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/commons-io/commons-io -->
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.11.0</version>
        </dependency>

        <!-- https://mvnrepository.com/artifact/org.json/json -->
        <dependency>
            <groupId>org.json</groupId>
            <artifactId>json</artifactId>
            <version>20220320</version>
        </dependency>


    </dependencies>
</project>
    
rajesh k
  • 15
  • 5

0 Answers0