Welcome to the new Parasoft forums! We hope you will enjoy the site and try out some of the new features, like sharing an idea you may have for one of our products or following a category.

Soatest maven is not able to locate the transient dependency of a project

Sourabh25
Sourabh25 Posts: 37

Hi,

I am adding one project as a dependency in my maven soatest project as below


com.myorg.selenium
logtransactions
1.6-SNAPSHOT

However I am getting the below error :

org.apache.log4j.Logger.trace(Ljava/lang/Object;)V
java.lang.NoSuchMethodError: org.apache.log4j.Logger.trace(Ljava/lang/Object;)V
at com.myorg.logging.logtransactions.LoggerMainImpl.removeUnwantedVals(LoggerMainImpl.java:275)

Please find the pom.xml for logtransaction project


4.0.0
logtransactions
jar

<name>logtransactions</name>
<url>http://maven.apache.org</url>

<parent>
    <groupId>com.myorg.selenium</groupId>
    <artifactId>CSAF</artifactId>
    <version>1.6-SNAPSHOT</version>
</parent>

<properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
    <jgitflow.username>ohegde001c</jgitflow.username>
    <jgitflow.password>Welcome117</jgitflow.password>
    <jgitflow.noDeploy>true</jgitflow.noDeploy>
</properties>

<distributionManagement>
    <repository>
        <id>century-releases</id>
        <name>Century Release Repository</name>
        <url>https://nexus.myorg.com/nexus/content/repositories/hosted-century-releases/</url>
        <uniqueVersion>true</uniqueVersion>
    </repository>
    <snapshotRepository>
        <id>century-snapshots</id>
        <name>Century Snapshot repository</name>
        <url>https://nexus.myorg.com/nexus/content/repositories/hosted-century-snapshots/</url>
        <uniqueVersion>false</uniqueVersion>
    </snapshotRepository>
</distributionManagement>

<dependencies>

    <!-- <dependency>
        <groupId>com.myorg.logging</groupId>
        <artifactId>transactions</artifactId>
        <version>1.0</version>
        <exclusions>
            <exclusion>
                <groupId>org.seleniumhq.selenium</groupId>
                <artifactId>selenium-server-standalone</artifactId>
            </exclusion>
        </exclusions>
    </dependency> -->
    <dependency>
        <groupId>log4j</groupId>
        <artifactId>log4j</artifactId>
        <version>1.2.17</version>
    </dependency>

    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.8.0</version>
    </dependency>
    <dependency>
        <groupId>com.mashape.unirest</groupId>
        <artifactId>unirest-java</artifactId>
        <version>1.4.9</version>
    </dependency>

</dependencies>

<build>
    <plugins>
        <plugin>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.1</version>
            <configuration>
                <compilerId>groovy-eclipse-compiler</compilerId>
                <source>1.8</source>
                <target>1.8</target>
            </configuration>
            <dependencies>
                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-compiler</artifactId>
                    <version>2.9.1-01</version>
                </dependency>

                <dependency>
                    <groupId>org.codehaus.groovy</groupId>
                    <artifactId>groovy-eclipse-batch</artifactId>
                    <version>2.3.7-01</version>
                </dependency>
            </dependencies>
        </plugin>

        <!-- <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-javadoc-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-javadocs</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                    <configuration>
                        <additionalparam>-Xdoclint:none</additionalparam>
                    </configuration>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-source-plugin</artifactId>
            <executions>
                <execution>
                    <id>attach-sources</id>
                    <goals>
                        <goal>jar</goal>
                    </goals>
                </execution>
            </executions>
        </plugin> -->

        <plugin>
            <groupId>external.atlassian.jgitflow</groupId>
            <artifactId>jgitflow-maven-plugin</artifactId>
            <version>1.0-m4.3</version>
            <configuration>
                <username>${jgitflow.username}</username>
                <password>${jgitflow.password}</password>
                <noDeploy>${jgitflow.noDeploy}</noDeploy>
                <flowInitContext>
                    <masterBranchName>release</masterBranchName>
                    <developBranchName>master</developBranchName>
                    <releaseBranchPrefix>release-</releaseBranchPrefix>
                    <versionTagPrefix>${project.artifactId}-</versionTagPrefix>
                </flowInitContext>
            </configuration>
        </plugin>

        <plugin>
          <artifactId>maven-assembly-plugin</artifactId>
          <configuration>
            <descriptor>assembly.xml</descriptor>
          </configuration>
          <executions>
        <execution>
          <id>make-assembly</id> <!-- this is used for inheritance merges -->
          <phase>package</phase> <!-- bind to the packaging phase -->
          <goals>
            <goal>single</goal>
          </goals>
        </execution>
      </executions>
        </plugin>

    </plugins>
    <pluginManagement>
        <plugins>
            <!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
            <plugin>
                <groupId>org.eclipse.m2e</groupId>
                <artifactId>lifecycle-mapping</artifactId>
                <version>1.0.0</version>
                <configuration>
                    <lifecycleMappingMetadata>
                        <pluginExecutions>
                            <pluginExecution>
                                <pluginExecutionFilter>
                                    <groupId>
                                        org.apache.maven.plugins
                                    </groupId>
                                    <artifactId>
                                        maven-compiler-plugin
                                    </artifactId>
                                    <versionRange>
                                        [3.1,)
                                    </versionRange>
                                    <goals>
                                        <goal>compile</goal>
                                        <goal>testCompile</goal>
                                    </goals>
                                </pluginExecutionFilter>
                                <action>
                                    <ignore />
                                </action>
                            </pluginExecution>
                        </pluginExecutions>
                    </lifecycleMappingMetadata>
                </configuration>
            </plugin>
        </plugins>
    </pluginManagement>
</build>

When i accessing the project from other selenium projects using I am not getting this issue. Can someone help me here

Tagged:

Comments

  • benken_parasoft
    benken_parasoft Posts: 1,302 ✭✭✭
    edited April 2018

    Please recall that SOAtest does not read or do anything with dependencies from your pom.xml.

    org.apache.log4j.Logger.trace(Ljava/lang/Object;)V
    java.lang.NoSuchMethodError: org.apache.log4j.Logger.trace(Ljava/lang/Object;)V
    at com.myorg.logging.logtransactions.LoggerMainImpl.removeUnwantedVals(LoggerMainImpl.java:275)

    Where are you seeing that error? Is it from Maven or from a test in SOAtest like a scripted field or Extension Tool? If it is from a script or Extension Tool, did you add the correct version of the log4j.jar that you require (Preferences > Parasoft > System Properties)?

  • Sourabh25
    Sourabh25 Posts: 37

    @benken_parasoft I am seeing this error when I am executing the script through maven.

  • benken_parasoft
    benken_parasoft Posts: 1,302 ✭✭✭

    Can you describe where are you seeing the error (maven output or SOAtest report or something else)? Please be specific. I'm trying to understand if you are saying this error is coming from maven or a particular maven plugin or SOAtest or something else.

  • Sourabh25
    Sourabh25 Posts: 37

    @benken_parasoft I am getting this error when i am execution the script using maven command:
    mvn clean test -Dparasoft.soatest.home="C:\Program Files\Parasoft\SOAtest & Virtualize\9.10" -Dparasoft.localsettings="C:\Users\SoaTestLocalSettings"
    The error is in the soatest report.

    However, when I am running a stand alone soatest with adding this jar in the system properties, the script is working fine.

    Please let me know if you need any m ore information on this.

    My concern is is there any limitation with soatest that it cannot reads the transient dependencies from maven. I don't think it should be the case otherwise there is no point of using maven.

  • grigorb
    grigorb Posts: 17

    SOAtest does not read dependence from maven pom as benken_parasoft mentioned, you may call there is no point in that case to run with maven but from other side it would be inconsistent when you run the same test in SOAtest or in SOAtest command line, so all dependencies should be in system properties .

  • jakubiak
    jakubiak Posts: 813 admin

    As Grigor and Joe mentioned, SOAtest does not use maven dependencies to find jars that it needs when executing Extension Tools or scripts within a SOAtest scenario. It uses the jars and classes that are set within the system properties preferences. It seems that you don't have the system properties preferences configured in your maven run the same way you have them configured when you run from GUI.

    You need to configure a localsettings file to point to the same jar that you are configuring in system properties in the GUI, and then use the localsettings file in your maven run. The documentation shows how to configure the localsettings file: https://docs.parasoft.com/display/SOA9104/Configuring+Localsettings. There is also a good forums post that describes in more detail how to do it – please see https://forums.parasoft.com/discussion/comment/8451.

    I see that you are attempting to pass a localsettings file using "-Dparasoft.localsettings". The value of that property needs to be the actual localsettings file; from what you posted it looks like you might be pointing to a directory and not a file. Can you ensure that you are pointing to a file?