当前位置: 首页 > 知识库问答 >
问题:

在Jenkins上运行Maven Web驱动测试,无法识别的错误

丁沛
2023-03-14

在使用EclipseIDE用Java编写了一些测试之后,我们想让它们在部署后自动运行。我已经将Maven配置为几乎与Jenkins一起工作,但还有一些问题。以下是其中之一:我试图运行一个无头文本(xvfb,firefox)ion jenkins,但输出如下:(我甚至无法确定问题出在哪里)

<===[JENKINS REMOTING CAPACITY]===>channel started

log4j:WARN No appenders could be found for logger (org.apache.commons.beanutils.converters.BooleanConverter).
log4j:WARN Please initialize the log4j system properly.

Executing Maven:  -B -f /mnt/www/jenkins/jobs/Integration Tests 2/workspace/pom.xml install

java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:331)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:174)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/cli/MavenLoggerManager
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:73)
    ... 18 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.cli.MavenLoggerManager
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    ... 19 more
channel stopped
ERROR: Failed to parse POMs
hudson.util.IOException2: java.lang.reflect.InvocationTargetException
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:162)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:66)
    at hudson.remoting.UserRequest.perform(UserRequest.java:118)
    at hudson.remoting.UserRequest.perform(UserRequest.java:48)
    at hudson.remoting.Request$2.run(Request.java:326)
    at hudson.remoting.InterceptingExecutorService$1.call(InterceptingExecutorService.java:72)
    at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:334)
    at java.util.concurrent.FutureTask.run(FutureTask.java:166)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1146)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.Exception: java.lang.reflect.InvocationTargetException
    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:177)
    at hudson.maven.Maven3Builder.call(Maven3Builder.java:100)
    ... 10 more
Caused by: java.lang.reflect.InvocationTargetException
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:616)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchStandard(Launcher.java:331)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:239)
    at org.jvnet.hudson.maven3.agent.Maven3Main.launch(Maven3Main.java:174)
    ... 11 more
Caused by: java.lang.NoClassDefFoundError: org/apache/maven/cli/MavenLoggerManager
    at org.jvnet.hudson.maven3.launcher.Maven3Launcher.main(Maven3Launcher.java:73)
    ... 18 more
Caused by: java.lang.ClassNotFoundException: org.apache.maven.cli.MavenLoggerManager
    at org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy.loadClass(SelfFirstStrategy.java:50)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:244)
    at org.codehaus.plexus.classworlds.realm.ClassRealm.loadClass(ClassRealm.java:230)
    ... 19 more
Finished: FAILURE

这是我的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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  <modelVersion>4.0.0</modelVersion>

  <groupId>com.pragmaticqa.tests</groupId>
  <artifactId>functionalTests</artifactId>
  <version>1.0-SNAPSHOT</version>
  <packaging>jar</packaging>
  <name>functionalTests</name>
  <url>http://maven.apache.org</url>
  <properties>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  </properties>
  <dependencies>
    <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-firefox-driver</artifactId>
        <version>2.32.0</version>
    </dependency>  
    <dependency>
          <groupId>org.testng</groupId>
          <artifactId>testng</artifactId>
          <version>6.8</version>
          <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>net.sf.opencsv</groupId>
        <artifactId>opencsv</artifactId>
        <version>2.0</version>
    </dependency>
  </dependencies>
  <build>
  <plugins>
    <plugin>
        <groupId>org.codehaus.mojo</groupId>
        <artifactId>selenium-maven-plugin</artifactId>
        <version>2.3</version>
        <executions>
            <execution>
                <id>xvfb</id>
                <phase>pre-integration-test</phase>
                <goals>
                    <goal>xvfb</goal>
                </goals>
            </execution>
            <execution>
                <id>selenium</id>
                <phase>pre-integration-test</phase>
                <goals>
                    <goal>start-server</goal>
                </goals>
                <configuration>
                    <background>true</background>
                </configuration>
            </execution>
        </executions>
    </plugin>
   </plugins>
   </build>
</project>

共有2个答案

岑畅
2023-03-14

看起来这个错误被JENKINS-15935这个bug覆盖了。它在Jenkins版本1.526中进行了更正,根据变更日志,修复似乎还没有进入LTS版本(截至版本1.509.3)。

当我遇到这个错误时,我只是切换回Maven 3.0.5,它为我纠正了这个问题。一旦我有时间更新我们的詹金斯安装,我会再给Maven 3.1一次机会。

袁恩
2023-03-14

查看异常跟踪,您在获得ClassNotFoundException时缺少了一些类,因此InvocationTargetException。如果你还没有尝试过的话,你可以尝试几件事。

  1. 升级你的maven

你可能可以在这里找到答案。希望有帮助

 类似资料:
  • 在此处输入图像描述 所以每当我运行我的conf.js文件时,WebDriver实例就会启动,但它会超时:(。(见附件图片) 结果是无法接触到铬。 我的环境是这样设置的: > 铬驱动器2.26 selenium-server-standalone-2.53.1 硒-webdriver@3.0.1 安装了CHROME浏览器55 量角器5.0.0 这是我的conf.js文件 }

  • 我在Jenkins做一个terraform测试。以下是我所做的: > 已安装terraform插件 我知道它看不到地球形态,但我怎么才能让它看到呢?我用github回购来获取消息。我想为每个terraform命令做一个步骤:init、plan和apply。我怎样才能做到这是詹金斯?我找不到任何教程解释这一点。多谢了。

  • 我尝试将Jenkins作业设置为使用BrowserStack运行测试。在本地,测试运行良好,驱动程序初始化,会话创建,测试开始运行,使用“。在Jenkins安装了一个插件。但下面的错误存在。 如果我在本地设置则存在以下错误 在本地设置后,错误将指向以下行 我希望通过Jenkins与BrowserStack的连接应该在本地完成。 提前道谢。

  • 我在Ubuntu服务器上最近安装的Jenkins上运行自动化项目时遇到了麻烦。我有以下错误: 我已经读到应该更新selenium webdriver gem,但我已经更新了它。也在詹金斯安装了firefox插件,但仍然无法运行。

  • 问题内容: 我正在尝试从Jenkins运行TestNG测试(在一个包含的Java项目中),但是没有运气。 似乎Jenkins的TestNG插件(https://wiki.jenkins-ci.org/display/JENKINS/testng- plugin )仅发布TestNG测试的结果,但实际上不运行测试类…或我错了吗? 无论如何,我如何在Jenkins的TestNG项目中实际运行TestN

  • 我试图从Jenkins那里运行TestNG测试(在一个包含Java的项目中),但没有成功。 看起来好像是Jenkins的TestNG插件(https://wiki.jenkins-ci.org/display/JENKINS/testng-plugin)只发布TestNG测试的结果,但不实际运行测试类。。。还是我错了? 在任何情况下,我如何在与Jenkins的TestNG项目中实际运行TestNG