简体   繁体   English

GitLab Runner 不一致:exec-maven-plugin:1.6.0:java org.apache.http.conn.HttpHostConnectException

[英]GitLab Runner Inconsistency: exec-maven-plugin:1.6.0:java org.apache.http.conn.HttpHostConnectException

We have an automation project on GitLab that uses our dedicated "shell" GitLab runner.我们在 GitLab 上有一个自动化项目,它使用我们专用的“shell”GitLab runner。 Project itself is a Selenium project that runs Cucumbers tests and generates a report.项目本身是一个运行 Cucumbers 测试并生成报告的 Selenium 项目。 It was recently running on Jenkins with no problem whatsoever.它最近在 Jenkins 上运行没有任何问题。 To simulate the Jenkins environment, I created a shell GitLab runner installed Java, Maven etc. on the machine with same versions.为了模拟 Jenkins 环境,我创建了一个 shell GitLab runner,在相同版本的机器上安装了 Java、Maven 等。 Dug up plenty of resources online.在网上挖了很多资源。 Modified everything all the way from my "hosts" file.从我的“主机”文件一路修改所有内容。 But not managed to solve this issue.但没有设法解决这个问题。

Tests are running fine and generate the report.测试运行良好并生成报告。 But the "generate report part" is inconsistent.但是“生成报告部分”不一致。 Meaning that sometimes it's not able to generate the Cucumber report.这意味着有时它无法生成 Cucumber 报告。 Two days it's working fine and the next day it bumps to a wall.两天它工作正常,第二天它撞到墙上。

Section of the pom file: pom 文件的一部分:

<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>1.6.0</version>

The problem is not the execution of the tests, they're always successful.问题不在于测试的执行,它们总是成功的。 Problem occurs afterwards.之后出现问题。 Cucumber cannot generate the report every once in few builds even though nothing has changed neither code-wise nor infrastructure-wise. Cucumber 不能每隔几次构建就生成一次报告,即使在代码方面和基础设施方面都没有发生任何变化。

This is the error we get after the tests are succesful:这是我们在测试成功后得到的错误:

[WARNING] 
org.openqa.selenium.WebDriverException: org.apache.http.conn.HttpHostConnectException: Connect to localhost:23723 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
System info: host: 'ip-XcensoredX', ip: 'ip-XcensoredX', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1051-aws', java.version: '11.0.4'
Driver info: driver.version: RemoteWebDriver
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute (DriverCommandExecutor.java:91)
    at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:637)
    at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:694)
    at org.openqa.selenium.remote.RemoteWebDriver.quit (RemoteWebDriver.java:533)
    at com.company.testautomation.util.WebDriverUtils.shutDown (WebDriverUtils.java:589)
    at com.company.testautomation.CucumberRunner.<init> (CucumberRunner.java:142)
    at com.company.testautomation.CucumberRunner.main (CucumberRunner.java:69)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:834)
Caused by: org.apache.http.conn.HttpHostConnectException: Connect to localhost:23723 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect (DefaultHttpClientConnectionOperator.java:159)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect (PoolingHttpClientConnectionManager.java:359)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute (MainClientExec.java:381)
    at org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:237)
    at org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute (RedirectExec.java:111)
    at org.apache.http.impl.client.InternalHttpClient.doExecute (InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:72)
    at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:56)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute (ApacheHttpClient.java:139)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.execute (ApacheHttpClient.java:87)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute (HttpCommandExecutor.java:161)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute (DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:637)
    at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:694)
    at org.openqa.selenium.remote.RemoteWebDriver.quit (RemoteWebDriver.java:533)
    at com.company.testautomation.util.WebDriverUtils.shutDown (WebDriverUtils.java:589)
    at com.company.testautomation.CucumberRunner.<init> (CucumberRunner.java:142)
    at com.company.testautomation.CucumberRunner.main (CucumberRunner.java:69)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:834)
Caused by: java.net.ConnectException: Connection refused (Connection refused)
    at java.net.PlainSocketImpl.socketConnect (Native Method)
    at java.net.AbstractPlainSocketImpl.doConnect (AbstractPlainSocketImpl.java:399)
    at java.net.AbstractPlainSocketImpl.connectToAddress (AbstractPlainSocketImpl.java:242)
    at java.net.AbstractPlainSocketImpl.connect (AbstractPlainSocketImpl.java:224)
    at java.net.SocksSocketImpl.connect (SocksSocketImpl.java:403)
    at java.net.Socket.connect (Socket.java:591)
    at org.apache.http.conn.socket.PlainConnectionSocketFactory.connectSocket (PlainConnectionSocketFactory.java:75)
    at org.apache.http.impl.conn.DefaultHttpClientConnectionOperator.connect (DefaultHttpClientConnectionOperator.java:142)
    at org.apache.http.impl.conn.PoolingHttpClientConnectionManager.connect (PoolingHttpClientConnectionManager.java:359)
    at org.apache.http.impl.execchain.MainClientExec.establishRoute (MainClientExec.java:381)
    at org.apache.http.impl.execchain.MainClientExec.execute (MainClientExec.java:237)
    at org.apache.http.impl.execchain.ProtocolExec.execute (ProtocolExec.java:185)
    at org.apache.http.impl.execchain.RetryExec.execute (RetryExec.java:89)
    at org.apache.http.impl.execchain.RedirectExec.execute (RedirectExec.java:111)
    at org.apache.http.impl.client.InternalHttpClient.doExecute (InternalHttpClient.java:185)
    at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:72)
    at org.apache.http.impl.client.CloseableHttpClient.execute (CloseableHttpClient.java:56)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.fallBackExecute (ApacheHttpClient.java:139)
    at org.openqa.selenium.remote.internal.ApacheHttpClient.execute (ApacheHttpClient.java:87)
    at org.openqa.selenium.remote.HttpCommandExecutor.execute (HttpCommandExecutor.java:161)
    at org.openqa.selenium.remote.service.DriverCommandExecutor.execute (DriverCommandExecutor.java:82)
    at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:637)
    at org.openqa.selenium.remote.RemoteWebDriver.execute (RemoteWebDriver.java:694)
    at org.openqa.selenium.remote.RemoteWebDriver.quit (RemoteWebDriver.java:533)
    at com.company.testautomation.util.WebDriverUtils.shutDown (WebDriverUtils.java:589)
    at com.company.testautomation.CucumberRunner.<init> (CucumberRunner.java:142)
    at com.company.testautomation.CucumberRunner.main (CucumberRunner.java:69)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.mojo.exec.ExecJavaMojo$1.run (ExecJavaMojo.java:282)
    at java.lang.Thread.run (Thread.java:834)
[WARNING] thread Thread[OkHttp ConnectionPool,5,com.company.testautomation.CucumberRunner] was interrupted but is still alive after waiting at least 15000msecs
[WARNING] thread Thread[OkHttp ConnectionPool,5,com.company.testautomation.CucumberRunner] will linger despite being asked to die via interruption
[WARNING] thread Thread[Okio Watchdog,5,com.company.testautomation.CucumberRunner] will linger despite being asked to die via interruption
[WARNING] thread Thread[UrlChecker-19,5,com.company.testautomation.CucumberRunner] will linger despite being asked to die via interruption
[WARNING] NOTE: 3 thread(s) did not finish despite being asked to  via interruption. This is not a problem with exec:java, it is a problem with the running code. Although not serious, it should be remedied.
[WARNING] Couldn't destroy threadgroup org.codehaus.mojo.exec.ExecJavaMojo$IsolatedThreadGroup[name=com.company.testautomation.CucumberRunner,maxpri=10]
java.lang.IllegalThreadStateException
    at java.lang.ThreadGroup.destroy (ThreadGroup.java:776)
    at org.codehaus.mojo.exec.ExecJavaMojo.execute (ExecJavaMojo.java:321)
    at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
    at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
    at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
    at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:305)
    at org.apache.maven.DefaultMaven.doExecute (DefaultMaven.java:192)
    at org.apache.maven.DefaultMaven.execute (DefaultMaven.java:105)
    at org.apache.maven.cli.MavenCli.execute (MavenCli.java:956)
    at org.apache.maven.cli.MavenCli.doMain (MavenCli.java:288)
    at org.apache.maven.cli.MavenCli.main (MavenCli.java:192)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at jdk.internal.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.java:62)
    at jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke (Method.java:566)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced (Launcher.java:282)
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch (Launcher.java:225)
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode (Launcher.java:406)
    at org.codehaus.plexus.classworlds.launcher.Launcher.main (Launcher.java:347)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:29 h
[INFO] Finished at: 2019-11-29T00:17:20+03:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java (Execute Cucumber tests) on project TestAutomation: An exception occured while executing the Java class. org.apache.http.conn.HttpHostConnectException: Connect to localhost:23723 [localhost/127.0.0.1] failed: Connection refused (Connection refused)
[ERROR] Build info: version: '3.4.0', revision: 'unknown', time: 'unknown'
[ERROR] System info: host: 'ip-XcensoredX', ip: 'XcensoredX', os.name: 'Linux', os.arch: 'amd64', os.version: '4.15.0-1051-aws', java.version: '11.0.4'
[ERROR] Driver info: driver.version: RemoteWebDriver
[ERROR] -> [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

And build fails.并且构建失败。 If a pipeline works, good.如果管道有效,那很好。 If it doesn't, then it needs a fix.如果没有,则需要修复。 But having an unstable pipeline is something that nobody wants.但是拥有不稳定的管道是没有人想要的。

Thanks in advance.提前致谢。

Add添加

<properties>
    <java.version>...</java.version>
    <exec.mainClass>....<mainClass>
    <exec.cleanupDaemonThreads>false</exec.cleanupDaemonThreads>
</properties>

To your pom.xml or add到您的 pom.xml 或添加

-Dexec.cleanupDaemonThreads=false

to the command line.到命令行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 org.apache.http.conn.HttpHostConnectException:拒绝连接到http:// localhost - org.apache.http.conn.HttpHostConnectException: Connection to http://localhost refused org.apache.http.conn.HttpHostConnectException:连接到127.0.0.1:7055 - org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:7055 错误:请求中的异常:org.apache.http.conn.HttpHostConnectException:与http:// ********:80的连接被拒绝 - ERROR:Exception in request: org.apache.http.conn.HttpHostConnectException: Connection to http://********:80 refused org.apache.http.conn.HttpHostConnectException:连接到127.0.0.1:7055 [/127.0.0.1]失败:连接被拒绝:connect - org.apache.http.conn.HttpHostConnectException: Connect to 127.0.0.1:7055 [/127.0.0.1] failed: Connection refused: connect 线程“ main” org.apache.http.conn.HttpHostConnectException中的异常:连接到//失败:连接超时:connect - Exception in thread “main” org.apache.http.conn.HttpHostConnectException: Connect to // failed: Connection timed out: connect 在jmeter中收到错误“响应代码:非HTTP响应代码:org.apache.http.conn.HttpHostConnectException” - Getting an error “Response code: Non HTTP response code: org.apache.http.conn.HttpHostConnectException” in jmeter Android Studio错误org.apache.http.conn.HttpHostConnectException:拒绝与http://10.0.2.2:8080的连接 - Android Studio error org.apache.http.conn.HttpHostConnectException: Connection to http://10.0.2.2:8080 refused 从Eclipse访问URL时获取org.apache.http.conn.HttpHostConnectException - Getting org.apache.http.conn.HttpHostConnectException while accessing a URL from Eclipse Selenium 3.7:geckodriver:WebDriverException:org.apache.http.conn.HttpHostConnectException连接被拒绝 - Selenium 3.7 : geckodriver : WebDriverException: org.apache.http.conn.HttpHostConnectException Connection Refused 目标 org.codehaus.mojo:exec-maven-plugin:1.6.0:java 的参数“mainClass”丢失或无效 - The parameters 'mainClass' for goal org.codehaus.mojo:exec-maven-plugin:1.6.0:java are missing or invalid
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM