Search code examples
javaseleniumdebiangeckodriverraspberry-pi4

Java, Selenium, Debian for Raspberry Pi 4, geckodriver error prints garbage


Im making a Java program that uses Selenium to access webpages and retrieve data, it works on Windows, pure Debian and Ubuntu but when I run it on my RPI4 with Debian for Raspberry Pi 4, the geckodriver gives cryptic errors and the program crashes.

The errors are as follows:

/usr/local/bin/geckodriver: 2: /usr/local/bin/geckodriver: YM9sHIiHMIi԰: not found
/usr/local/bin/geckodriver: 1: /usr/local/bin/geckodriver: Syntax error: end of file unexpected (expecting ")")
/usr/local/bin/geckodriver: 1: /usr/local/bin/geckodriver: 6: not found
/usr/local/bin/geckodriver: 1: /usr/local/bin/geckodriver: : not found
/usr/local/bin/geckodriver: 1: /usr/local/bin/geckodriver: : not found
/usr/local/bin/geckodriver: 1: /usr/local/bin/geckodriver: 6: not found
/usr/local/bin/geckodriver: 1: /usr/local/bin/geckodriver: $/: not found
/usr/local/bin/geckodriver: 1: /usr/local/bin/geckodriver: GNUu¬wת,岹PXH: not found
/usr/local/bin/geckodriver: 1: /usr/local/bin/geckodriver: ELF: not found
Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:29555
Build info: version: 'unknown', revision: 'unknown', time: 'unknown'
System info: host: 'raspy', ip: '192.168.1.33', os.name: 'Linux', os.arch: 'aarch64', os.version: '5.9.0-0.bpo.5-arm64', java.version: '11.0.9.1'
Driver info: driver.version: FirefoxDriver
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:92)
        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.firefox.FirefoxDriver.<init>(FirefoxDriver.java:147)
        at net.ddns.creepercrack.Main.main(Main.java:40)
Caused by: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:29555
        at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:247)
        at okhttp3.internal.connection.RealConnection.connect(RealConnection.java:165)
        at okhttp3.internal.connection.StreamAllocation.findConnection(StreamAllocation.java:257)
        at okhttp3.internal.connection.StreamAllocation.findHealthyConnection(StreamAllocation.java:135)
        at okhttp3.internal.connection.StreamAllocation.newStream(StreamAllocation.java:114)
        at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:42)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:126)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
        at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
        at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
        at okhttp3.RealCall.execute(RealCall.java:77)
        at org.openqa.selenium.remote.internal.OkHttpClient.execute(OkHttpClient.java:103)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:105)
        at org.openqa.selenium.remote.ProtocolHandshake.createSession(ProtocolHandshake.java:74)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:136)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
        ... 5 more
Caused by: java.net.ConnectException: Connection refused (Connection refused)
        at java.base/java.net.PlainSocketImpl.socketConnect(Native Method)
        at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:399)
        at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:242)
        at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:224)
        at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:403)
        at java.base/java.net.Socket.connect(Socket.java:609)
        at okhttp3.internal.platform.Platform.connectSocket(Platform.java:129)
        at okhttp3.internal.connection.RealConnection.connectSocket(RealConnection.java:245)
        ... 27 more

The program also creates this file: ''$'\001\022\002''@@'$'\230\204''y@8'$'\a''@'$'\035\032\001\005''@@t'$'\202''6t'$'\202''6', but I did not program that myself. This does not happen when the program works, only when it crashes.

It may be that it just does not work but I would like to know the answer. The geckodriver is correcly in the PATH inside the program and is executable Also, firefox-esr and default-jre.


Solution

    1. With regard to the "garbage" being printed when using
      'gekodriver', perhaps it is because its not meant for the platform
      (hardware + operating_system) you are using?
    2. With regard to

    Exception in thread "main" org.openqa.selenium.WebDriverException: java.net.ConnectException: Failed to connect to localhost/0:0:0:0:0:0:0:1:29555 Build info: version: 'unknown', revision: 'unknown', time: 'unknown' System info: host: 'raspy', ip: '192.168.1.33', os.name: 'Linux', os.arch: 'aarch64', os.version: '5.9.0-0.bpo.5-arm64', java.version: '11.0.9.1'

    That would indicate that there is nothing listening on 29555 on tcp6 ip protocol.

    Above are just guesses that you can try looking into until someone better informed comes along.