简体   繁体   English

在树莓派上从 java 应用程序启动 chromedriver 时出错

[英]Error while starting chromedriver from java application on raspberry pi

I want to run my java standalone jar on my raspberry pi (Model 3B+).我想在我的树莓派(型号 3B+)上运行我的 java 独立 jar。 It depends on seleneium, so it needs chromedriver.它依赖于硒,所以它需要 chromedriver。 I have installed java 14 and also chromedrivers version 95.0.4638.78-rpt6 via我已经安装了 java 14 以及 chromedrivers 版本 95.0.4638.78-rpt6 通过

sudo apt-get install chromium-chromedriver

now I have installed:现在我已经安装了:

dpkg -l | grep chromium
ii  chromium-browser                     95.0.4638.78-rpt6                armhf        Chromium web browser, open-source version of
ii  chromium-browser-l10n                95.0.4638.78-rpt6                all          chromium-browser language packages
ii  chromium-chromedriver                95.0.4638.78-rpt6                armhf        WebDriver driver for the Chromium Browser
ii  chromium-codecs-ffmpeg-extra         95.0.4638.78-rpt6                armhf        Extra ffmpeg codecs for the Chromium Browser
ii  rpi-chromium-mods                    20220111 

When I start my application now, I get this log:当我现在启动我的应用程序时,我得到这个日志:

WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.bouncycastle.jcajce.provider.drbg.DRBG                                                     (file:/home/pi/StreamCrawler.jar) to constructor sun.security.provider.Sun()
WARNING: Please consider reporting this to the maintainers of org.bouncycastle.j                                                    cajce.provider.drbg.DRBG
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflect                                                    ive access operations
WARNING: All illegal access operations will be denied in a future release
/usr/bin/chromedriver: 5: Syntax error: word unexpected (expecting ")")
Feb 06, 2022 6:39:21 PM org.openqa.selenium.os.OsProcess checkForError
SEVERE: org.apache.commons.exec.ExecuteException: Process exited with an error: 2 (Exit value: 2)
Exception in thread "Thread-1" org.openqa.selenium.WebDriverException: Timed out waiting for driver server to start.
Build info: version: 'unknown', revision: 'e82be7d358', time: '2018-11-14T08:24:01'
System info: host: 'raspberrypi', ip: '127.0.1.1', os.name: 'Linux', os.arch: 'arm', os.version: '5.10.92-v7+', java.version: '14'
Driver info: driver.version: ChromeDriver
        at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:202)
        at org.openqa.selenium.remote.service.DriverService.start(DriverService.java:188)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:79)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:552)
        at org.openqa.selenium.remote.RemoteWebDriver.startSession(RemoteWebDriver.java:213)
        at org.openqa.selenium.remote.RemoteWebDriver.<init>(RemoteWebDriver.java:131)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:181)
        at org.openqa.selenium.chrome.ChromeDriver.<init>(ChromeDriver.java:147)
        at crawler.RequestCrawler.getPlaylistURL(RequestCrawler.java:48)
        at crawler.StreamCrawler.crawl(StreamCrawler.java:29)
        at crawler.StateChecker.run(StateChecker.java:37)
        at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: org.openqa.selenium.net.UrlChecker$TimeoutException: Timed out waiting for [http://localhost:11309/status] to be available after 20017 ms
        at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:100)
        at org.openqa.selenium.remote.service.DriverService.waitUntilAvailable(DriverService.java:197)
        ... 11 more
Caused by: java.util.concurrent.TimeoutException
        at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:204)
        at com.google.common.util.concurrent.SimpleTimeLimiter.callWithTimeout(SimpleTimeLimiter.java:156)
        at org.openqa.selenium.net.UrlChecker.waitUntilAvailable(UrlChecker.java:75)
        ... 12 more

On my windows machine it runs fine.在我的 windows 机器上它运行良好。 But on windows I am using chromedriver 98, not 95. Now I am not sure what to do as next step.但是在 windows 上,我使用的是 chromedriver 98,而不是 95。现在我不确定下一步该怎么做。

Option A is an update of the chromedrivers to 98 on my raspberry.选项 A 是将我的树莓派上的 chromedriver 更新为 98。 But when I am checking out https://archive.raspberrypi.org/debian/pool/main/c/chromium-browser/ , there is no 98. In https://chromedriver.storage.googleapis.com/index.html?path=98.0.4758.80/ I can find a 98 Linux version but how to install that file without extension?但是当我查看https://archive.raspberrypi.org/debian/pool/main/c/chromium-browser/时,没有 98。在https://chromedriver.storage.googleapis.com/index.html ?path=98.0.4758.80/我可以找到 98 Linux 版本但是如何安装没有扩展名的文件?

Option B is a java application which runs with chromedrivers 95. Currently I use this selenium version:选项 B 是一个 java 应用程序,它与 chromedrivers 95 一起运行。目前我使用这个 selenium 版本:

   <dependency>
        <groupId>org.seleniumhq.selenium</groupId>
        <artifactId>selenium-java</artifactId>
        <version>3.141.59</version>
    </dependency>

Would it run if I use an older version?如果我使用旧版本它会运行吗? And which version do I need?我需要哪个版本?

Is there maybe an other better option?有没有其他更好的选择? Thanks for help!感谢帮助!

Within the Raspberrypi chromium-browser archive the latest version seems chromium-browser v95 .Raspberrypi chromium-browser 存档中,最新版本似乎是chromium-browser v95

So with the combination of:因此,结合以下内容:

  • selenium=3.141.59硒=3.141.59
  • chromium-browser=95.0.4638.78铬浏览器=95.0.4638.78
  • chromedriver=95.0.4638.69 chromedriver=95.0.4638.69

would be definately good to go.对 go 肯定有好处。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM