Bug - Fixed "net.sourceforge.kolmafia.swingui.LoginFrame could not be loaded"

JaAchan

New member
Hey,

I'm trying to get KoLmafia to run for Crimbo again this year. Had to update Java from 8 to 17, that was easy enough. But now I'm getting the following error:

=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
KoLmafia r26047, Linux, Java 17.0.1
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Please note: do not post this log in the KoLmafia thread of KoL's
Gameplay-Discussion forum. If you would like the KoLmafia dev team
to look at it, please write a bug report at kolmafia.us. Include
specific information about what you were doing when you made this
and include this log as an attachment.
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
Timestamp: Tue Dec 21 18:52:18 UTC 2021
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
User:
Current run: 0
MRU Script: Unknown
=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=


net.sourceforge.kolmafia.swingui.LoginFrame could not be loaded
class java.lang.UnsupportedOperationException: Desktop API is not supported on the current platform
java.lang.UnsupportedOperationException: Desktop API is not supported on the current platform
at java.desktop/java.awt.Desktop.getDesktop(Desktop.java:304)
at net.sourceforge.kolmafia.CreateFrameRunnable.addMenuItems(CreateFrameRunnable.java:261)
at net.sourceforge.kolmafia.CreateFrameRunnable.decorate(CreateFrameRunnable.java:251)
at net.sourceforge.kolmafia.CreateFrameRunnable.runConstruction(CreateFrameRunnable.java:229)
at net.sourceforge.kolmafia.CreateFrameRunnable.createFrame(CreateFrameRunnable.java:128)
at net.sourceforge.kolmafia.CreateFrameRunnable.run(CreateFrameRunnable.java:114)
at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:308)
at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:771)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:722)
at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:716)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:399)
at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:86)
at java.desktop/java.awt.EventQueue.dispatchEvent(EventQueue.java:741)
at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:203)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:124)
at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:113)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:109)
at java.desktop/java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.desktop/java.awt.EventDispatchThread.run(EventDispatchThread.java:90)
net.sourceforge.kolmafia.swingui.LoginFrame could not be loaded

I don't really have any clue as to how to fix this.

I do run it in a docker, I'm sure that doesn't help, but I rather not unlease Java any further on my system than necessary. Previous years this was no issue at all (except ofc it can't open a browser for me, which is not a problem for me).

Dockerfile:
FROM openjdk:17-buster

ARG KOL_VERSION

ADD https://ci.kolmafia.us/job/Kolmafia/lastSuccessfulBuild/artifact/dist/KoLmafia-${KOL_VERSION}.jar /KoLmafia-latest.jar

RUN apt-get update && apt-get -y install libxext6 libxrender1 libxtst6

CMD ["java", "-jar", "/KoLmafia-latest.jar"]


Makefile:
run:
xhost +
docker run -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix${DISPLAY} -v $(shell pwd)/.kolmafia:/root/.kolmafia --rm --name k
olmafia kolmafia:latest

build:
test "${KOL_VERSION}" # Hint: make build KOL_VERSION=19xxx
docker build . -t kolmafia --build-arg KOL_VERSION=$(KOL_VERSION)

I'm well versed with docker but not so much with Java, so would appreciate any tips that you may have
 
Last edited by a moderator:

fronobulax

Developer
Staff member
I have much more experience with Docker as a line of clothing.

Two things jump out. When KoLmafia has problems starting up there are sometimes messages written to the console but no where else.

So could you somehow run "java", "-jar", "/KoLmafia-latest.jar" and see if there is some output?

KoLmafia wants to create some directories on first startup so is it possible that there is a problem with write protections somewhere?

The Login Frame is Java/Swing and if Java/Swing can't figure out where to "create" the display there could be an error. Are all your X11 settings working?

Finally I see "Desktop API is not supported on the current platform".

Without looking at the code it could be a mafia problem in that we are not expecting whatever docker is running as a Desktop. It could also be a Java issue. There are reports from long ago that people made this go away by switching from OpenJDK to Oracle.

Maybe that gives you something to think about until someone who knows what they are doing comes along.
 

heeheehee

Developer
Staff member
Does that exception actually affect anything, other than printing a stack trace? It should be immediately caught by CreateFrameRunnable.decorate(). Either way, we can fix that easily.
 

JaAchan

New member
I'm running r26052 now and it's running normally. Thanks a lot for the quick fix!

Does that exception actually affect anything?
Yeah, it wouldn't completely show the login form, so I couldn't actually do anything. I think I forgot to mention that :)
 
Top