testIT-LivingDoc / livingdoc-core

This is the GitHub Repository of testIT LivingDoc core components - The exclusive solution to bring your acceptance tests to Atlassian Confluence.
https://testit-livingdoc.atlassian.net/wiki
GNU General Public License v3.0
34 stars 18 forks source link

java.lang.LinkageError after executing a recorded Selenium test #15

Closed sparsick closed 8 years ago

sparsick commented 8 years ago

Hi LivingDoc Team,

we currently evaluate LivingDoc and get following error messages inside confluence executing a recorded Selenium test against the Spring petclinic.war

Version numbers: JDK Version is 1.7.0.80 Tomcat is 8.0.30 Confluence Versions is 5.7.1

Error message java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.apache.xpath.XPathContext$XPathExpressionContext.getVariableOrParam(Lorg/apache/xml/utils/QName;)Lorg/apache/xpath/objects/XObject;" the class loader (instance of info/novatec/testit/livingdoc/util/JoinClassLoader) of the current class, org/apache/xpath/XPathContext$XPathExpressionContext, and the class loader (instance of org/apache/catalina/loader/WebappClassLoader) for interface org/apache/xalan/extensions/ExpressionContext have different Class objects for the type text.getVariableOrParam(Lorg/apache/xml/utils/QName;)Lorg/apache/xpath/objects/XObject; used in the signature at org.apache.xpath.XPathContext.(XPathContext.java:1057) at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:107) at org.apache.xpath.jaxp.XPathExpressionImpl.eval(XPathExpressionImpl.java:91) at org.apache.xpath.jaxp.XPathExpressionImpl.evaluate(XPathExpressionImpl.java:176) at org.openqa.selenium.firefox.internal.FileExtension.readIdFromInstallRdf(FileExtension.java:121) at org.openqa.selenium.firefox.internal.FileExtension.writeTo(FileExtension.java:61) at org.openqa.selenium.firefox.internal.ClasspathExtension.writeTo(ClasspathExtension.java:64) at org.openqa.selenium.firefox.FirefoxProfile.installExtensions(FirefoxProfile.java:443) at org.openqa.selenium.firefox.FirefoxProfile.layoutOnDisk(FirefoxProfile.java:421) at org.openqa.selenium.firefox.internal.NewProfileExtensionConnection.start(NewProfileExtensionConnection.java:95)

The POM of our fixture

<?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>
    <repositories>
        <repository>
            <id>central</id>
            <name>Central Repository</name>
            <url>http://repo.maven.apache.org/maven2</url>
            <layout>default</layout>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </repository>
    </repositories>
    <groupId>de.skmworld</groupId>
    <artifactId>acceptance-tests</artifactId>
    <packaging>jar</packaging>
    <version>0.0.1</version>
    <name>PetClinicSystem</name>
    <properties />
    <dependencies>
        <dependency>
        <groupId>info.novatec.testit</groupId>
        <artifactId>livingdoc-core</artifactId>
        <version>1.0.0</version> </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <version>4.11</version>
        </dependency>
        <dependency>
            <groupId>commons-net</groupId>
            <artifactId>commons-net</artifactId>
            <version>2.0</version>
        </dependency>
        <dependency>
            <groupId>commons-io</groupId>
            <artifactId>commons-io</artifactId>
            <version>2.4</version>
        </dependency>
        <dependency>
            <groupId>org.apache.commons</groupId>
            <artifactId>commons-lang3</artifactId>
            <version>3.0</version>
        </dependency>
        <dependency>
            <groupId>commons-collections</groupId>
            <artifactId>commons-collections</artifactId>
            <version>3.2.1</version>
        </dependency>
        <dependency>
            <groupId>org.seleniumhq.selenium</groupId>
            <artifactId>selenium-java</artifactId>
            <version>2.48.2</version>
        </dependency>
    </dependencies>
    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>test-jar</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <artifactId>maven-assembly-plugin</artifactId>
                <version>2.6</version>
                <executions>
                    <execution>
                        <id>jar-with-dep</id>
                        <goals>
                            <goal>single</goal>
                        </goals>
                        <phase>package</phase>
                        <configuration>
                            <descriptors>
                                <descriptor>src/assembly/src.xml</descriptor>
                            </descriptors>
                            <descriptorRefs>
                                <descriptorRef>jar-with-dependencies</descriptorRef>
                            </descriptorRefs>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
        </plugins>
    </build>
</project>

2016-02-23 16_53_51-livingdoc configuration - confluence 2016-02-23 17_06_46-petclinicowners - acceptancetests - confluence

We can provide the sources via Github if you want. Many thanks!

Sandra

benhamidene commented 8 years ago

Hi Sandra,

LinkageError is thrown when a class 'ABC' is loaded by more than one classloader and those classes are being used together in the same code (compared, cast, etc). Independent of whether it is the same Class name or even if it is loaded from an identical jar - a Class from one classloader is always treated as a different Class if loaded from another classloader.

I suppose you are using the internal Runner which is not recommended as it gets the tests to be run in the confluence instance / classloaders.

We recommend using a remote agent and running your tests through it. So all tests are run in an own process and with an own classloader:

https://testit-livingdoc.atlassian.net/wiki/display/CURDOC/Confluence+plugin#Confluenceplugin-RemoteAgent

Viel Erfolg ;)

sparsick commented 8 years ago

Thanks for the hint. I'll check it out in the next days.

sparsick commented 8 years ago

This hint helped. Thank you for your help.