seleniumvncjava-service-wrappertanuki

Tanuki Service Wrapper display access


I have a simple Java application that is using the Tanuki Service Wrapper that loads chromedriver for me. Everything works find when I execute things using ./myapp console as the user that owns the application and the VNC server.

However, after setting the RUN_AS_USER in the Tanuki setup and setting the DISPLAY variable in /etc/environment and all the profiles in Ubuntu 16.04, my Java application cannot access the display.

I installed VNC on Ubuntu 16.04 using these instructions.

I can run xeyes, xterm, etc. as any user after running xhost + and I ensure that the command runs on startup of the vncserver.

What happens is I get stuck on the following log message before I finally hit a timeout:

jvm 1 | Starting ChromeDriver 2.25.426924 (649f9b868f6783ec9de71c123212b908bf3b232e) on port 32655

jvm 1 | Only local connections are allowed.

I also tried editing the /etc/chromium-browser/default file to include the "--display :1" specification in the CHROMIUM_FLAGS option as was suggested in other posts with no luck.

The other option I have seen suggested was in the Java code to add, but this did not work:

webDriver.setEnvironmentProperty("DISPLAY", ":1");

Any suggestions?


Solution

  • I had similar issues in Ubuntu for the same purpose. We wound up switching to a RHEL 7 instance with TigerVNC.

    We were under the gun to get something accomplished and wound up actually sticking with it as there were no issues, even during an upgrade. I tried following the instructions you provided and had the same issue. The ones I followed for RHEL were very similar and can be found here:

    https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/System_Administrators_Guide/ch-TigerVNC.html

    You may want to try using TigerVNC on Ubuntu instead.