最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

java - Jenkins job freezes on executing jar web application - Stack Overflow

programmeradmin0浏览0评论

I try to execute jar web-application in Jenkins job and start Selenoid tests If i execute command "java -jar app.jar" in pipeline Jenkins - i get exception

2024-11-18 13:54:16,203 [main] [INFO] () [r.s.c.w.a.RemoteApplication]: Started RemoteApplication in 4.282 seconds (JVM running for 4.498) 2024-11-18 13:54:16,248 [main] [WARN] () [r.s.c.w.r.SimpleUrlBrowser]: Please open the following address in your browser: 2024-11-18 13:54:16,249 [main] [WARN] () [r.s.c.w.r.SimpleUrlBrowser]: http://localhost:20080 java.lang.Exception: No web browser found

and Jenkins job freezes endlessly, until I manually abort the build.

This is how I see the solution:

  1. curl jar from remote server
  2. execute jar by "java -jar app.jar"
  3. start Selenoid UI tests.
  4. stop the job

Is there any way to run jar bypassing this exception?

I try to execute jar web-application in Jenkins job and start Selenoid tests If i execute command "java -jar app.jar" in pipeline Jenkins - i get exception

2024-11-18 13:54:16,203 [main] [INFO] () [r.s.c.w.a.RemoteApplication]: Started RemoteApplication in 4.282 seconds (JVM running for 4.498) 2024-11-18 13:54:16,248 [main] [WARN] () [r.s.c.w.r.SimpleUrlBrowser]: Please open the following address in your browser: 2024-11-18 13:54:16,249 [main] [WARN] () [r.s.c.w.r.SimpleUrlBrowser]: http://localhost:20080 java.lang.Exception: No web browser found

and Jenkins job freezes endlessly, until I manually abort the build.

This is how I see the solution:

  1. curl jar from remote server
  2. execute jar by "java -jar app.jar"
  3. start Selenoid UI tests.
  4. stop the job

Is there any way to run jar bypassing this exception?

Share Improve this question asked Nov 18, 2024 at 12:50 rustCohlerustCohle 11 bronze badge
Add a comment  | 

1 Answer 1

Reset to default 0

The Jenkins node where the job is running has no browsers installed, or if it does then Selenoid cannot find any.

Here's something we've done to run Selenide tests on Jenkins:

docker.image('selenium/standalone-chrome').withRun('-v /dev/shm:/dev/shm -p 4444:4444') { c ->
    def selenideRemote = "http://0.0.0.0:4444/wd/hub"
    sh "mvn test -Dselenide.headless=true -Dselenide.remote=${selenideRemote} -DscreenshotsEnabled=true"
}

The combination of the Docker image, which has the proper browser etc. installed, and the headless option should make it work.

发布评论

评论列表(0)

  1. 暂无评论