Jump to content

OSBot fails to start without an X server


Timothyofawesome

Recommended Posts

I'm currently trying to get osbot to run inside of either a docker container or my linux server from ssh. I keep getting the error below. If I run it on my local linux machine it runs perfectly fine ( has an X server/graphical interface running). Any ideas on how to resolve this? I am using the same java installation between my working machine and docker. Setting the DISPLAY variable causes it to crash with null pointer exceptions.
 

[root@b011a9e823cc OSBot]# java -jar osbot.jar -allow nointerface -login redacted -bot redacted -script Skeleton:1 -world 301 -debug
Starting OSBot with no interfaces, inherits lowresource
Starting local script with name: Skeleton
Debug enabled on port 5005
Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
        at org.pushingpixels.neon.api.NeonCortex.getPlatform(NeonCortex.java:72)
        at org.pushingpixels.neon.api.NeonCortex.getDefaultFontPolicy(NeonCortex.java:104)
        at org.pushingpixels.substance.api.SubstanceCortex$GlobalScope.getFontPolicy(SubstanceCortex.java:510)
        at org.pushingpixels.substance.api.SubstanceCortex$GlobalScope.setSkin(SubstanceCortex.java:188)
        at org.pushingpixels.substance.api.SubstanceLookAndFeel.initialize(SubstanceLookAndFeel.java:209)
        at javax.swing.UIManager.setLookAndFeel(UIManager.java:538)
        at org.osbot.BotApplication.IIiiiiiiIiIi(rw:118)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
        at java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:709)
        at java.awt.EventQueue$3.run(EventQueue.java:703)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.awt.HeadlessException:
No X11 DISPLAY variable was set, but this program performed an operation which requires it.
        at sun.awt.HeadlessToolkit.getScreenResolution(HeadlessToolkit.java:226)
        at org.pushingpixels.neon.internal.contrib.jgoodies.looks.LookUtils.isLowResolution(LookUtils.java:196)
        at org.pushingpixels.neon.internal.contrib.jgoodies.looks.LookUtils.<clinit>(LookUtils.java:142)
        ... 21 more
[DEBUG][12/02 02:37:39 AM]: Injected 2 field list filters
[DEBUG][12/02 02:37:39 AM]: Injected 2 field filters
[DEBUG][12/02 02:37:39 AM]: Injected 2 method list filters
[DEBUG][12/02 02:37:39 AM]: Injected 3 method filters
Starting OSBot in low resource mode
In debug mode!
/bin/sh: line 1: Language:0: command not found
OpenJDK 64-Bit Server VM warning: Using incremental CMS is deprecated and will likely be removed in a future release
Listening for transport dt_socket at address: 5005
Stealth injection class-filter enabled!
Successfully loaded OSBot!
[INFO][12/02 02:37:40 AM]: Welcome to OSBot 2.6.37!
[INFO][12/02 02:37:41 AM]: Updated injection hooks for client revision : 201!
[DEBUG][Bot #1][12/02 02:37:41 AM]: Initializing stealth injection bot...
[ERROR][12/02 02:37:41 AM]: Uncaught exception!
java.lang.NullPointerException
        at org.osbot.QE.iiiIIiiiiIiI(cu:266)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:311)
        at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
        at java.awt.EventQueue.access$500(EventQueue.java:97)
        at java.awt.EventQueue$3.run(EventQueue.java:709)
        at java.awt.EventQueue$3.run(EventQueue.java:703)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
[INFO][Bot #1][12/02 02:37:41 AM]: Downloading latest RS2 old-school client parameters...
[INFO][Bot #1][12/02 02:37:42 AM]: Downloading latest RS2 old-school client...
[DEBUG][Bot #1][12/02 02:37:44 AM]: Injected bot reference into client!
[DEBUG][Bot #1][12/02 02:37:45 AM]: Injected world accessors!
[DEBUG][Bot #1][12/02 02:37:45 AM]: Injected 38 class and 341 field accessors!
[DEBUG][Bot #1][12/02 02:37:45 AM]: Injected canvas!
Bot failed to initialize! If you are running OSBot from command-line, ensure that the world you entered is valid! If the world you entered is valid, please check the OSBot forums for online/offline status.pg
        at ah.w(ah.java:103)
        at ai.<init>(ai.java:99)
        at client.<init>(client.java:130)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at java.lang.Class.newInstance(Class.java:442)

[INFO][12/02 02:37:52 AM]: Started bot #1
        at org.osbot.rs07.Bot.initialize(zp:838)
        at org.osbot.QE.IIiIiiiIiIii(cu:210)
Waiting for the game to load before starting script...
        at org.osbot.BotApplication.main(rw:246)
Script did not start automatically! Game took too long to load.

Any help is appreciated!

Link to comment
Share on other sites

Update: got it working!

Dockerfile:

FROM archlinux
RUN pacman -Syu --noconfirm

RUN mkdir -p /root/OSBot/Data
RUN mkdir -p /root/OSBot/Scripts

COPY Scripts/osbot.jar /root/OSBot/

COPY Data/map.bin /root/OSBot/Data
COPY Scripts/* /root/OSBot/Scripts/
COPY Automation/entrypoint.sh /

RUN pacman -S jre8-openjdk --noconfirm
RUN pacman -S xorg-server-xvfb --noconfirm

RUN pacman -S libxtst --noconfirm
RUN pacman -S libxrender --noconfirm

ENTRYPOINT ["./entrypoint.sh"]

 

Entrypoint.sh:

#!/bin/sh

Xvfb > /dev/null 2>&1 &
export DISPLAY=:0.0


java -jar /root/OSBot/osbot.jar -allow nointerface,lowcpu -login redacted -bot redacted -script Skeleton:1 -world 301
cat /proc/$(ps aux | grep "/root/OSBot/osbot.jar" | grep -v grep -m 1 | awk '{print $2}')/fd/1


Xvfb runs an X server with a display. 

Most of this was stolen from:

 

Just had to figure out the xserver stuff.

  • Like 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...