t-oster / VisiCut

A userfriendly tool to prepare, save and send Jobs to Lasercutters
https://visicut.org
Other
235 stars 115 forks source link

Visicut 1.9 fails to start on Ubuntu 22.04 #691

Closed jnweiger closed 11 months ago

jnweiger commented 1 year ago

(Also seen with VisiCut 1.8)

grafik

Should I try newer or older versions of Java?

ib@pib-VirtualBox:~/Downloads$ visicut 
openjdk version "19.0.2" 2023-01-17
Gtk-Message: 12:31:08.548: Failed to load module "canberra-gtk-module"
Notice: settings.private.xml is older than settings.xml; deleting settings.private.xml.
java.lang.ExceptionInInitializerError
    at com.thoughtworks.xstream.XStream.setupConverters(XStream.java:990)
    at com.thoughtworks.xstream.XStream.<init>(XStream.java:593)
    at com.thoughtworks.xstream.XStream.<init>(XStream.java:515)
    at com.thoughtworks.xstream.XStream.<init>(XStream.java:484)
    at com.thoughtworks.xstream.XStream.<init>(XStream.java:430)
    at com.thoughtworks.xstream.XStream.<init>(XStream.java:369)
    at de.thomas_oster.visicut.managers.PreferencesManager.getXStream(PreferencesManager.java:365)
    at de.thomas_oster.visicut.managers.PreferencesManager.loadPreferences(PreferencesManager.java:373)
    at de.thomas_oster.visicut.managers.PreferencesManager.getPreferences(PreferencesManager.java:300)
    at de.thomas_oster.visicut.gui.VisicutApp.initialize(VisicutApp.java:105)
    at org.jdesktop.application.Application$1.run(Application.java:170)
    at java.desktop/java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:318)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(EventQueue.java:773)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:720)
    at java.desktop/java.awt.EventQueue$4.run(EventQueue.java:714)
    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:742)
    at de.thomas_oster.visicut.gui.VisicutApp$1EventQueueProxy.dispatchEvent(VisicutApp.java:133)
    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)
Caused by: java.lang.reflect.InaccessibleObjectException: Unable to make field private final java.util.Comparator java.util.TreeMap.comparator accessible: module java.base does not "opens java.util" to unnamed module @228575c0
    at java.base/java.lang.reflect.AccessibleObject.throwInaccessibleObjectException(AccessibleObject.java:387)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:363)
    at java.base/java.lang.reflect.AccessibleObject.checkCanSetAccessible(AccessibleObject.java:311)
    at java.base/java.lang.reflect.Field.checkCanSetAccessible(Field.java:180)
    at java.base/java.lang.reflect.Field.setAccessible(Field.java:174)
    at com.thoughtworks.xstream.core.util.Fields.locate(Fields.java:40)
    at com.thoughtworks.xstream.converters.collections.TreeMapConverter.<clinit>(TreeMapConverter.java:50)
    ... 25 more
pib@pib-VirtualBox:~$ update-alternatives --list java
/usr/lib/jvm/java-19-openjdk-amd64/bin/java
jnweiger commented 1 year ago
sudo apt-get install openjdk-{11,17,18}-{jdk,jre}

and playing with update-alternatives --config java

Result: -> same crash with openjdk 17,18,19, -> visicut works fine with openjdk 11

mgmax commented 1 year ago

Please try the java options listed here for a first diagnosis: https://luppeng.wordpress.com/2023/04/01/use-openjdk-19-to-build-and-run-apache-atlas-v2-3-0/

--add-opens java.base/java.lang=ALL-UNNAMED --add-opens java.base/java.lang.reflect=ALL-UNNAMED -Djdk.reflect.useDirectMethodHandle=false

There the error message is similar to ours.

jnweiger commented 1 year ago

@mgmax thanks for the hint!

Workaround:

mgmax commented 1 year ago

Good to see that we have a work-around. I'm not sure why it broke, as we already apply a bunch of these "opens" settings in the pom.xml file. Visicut definitely worked with JDK17 at some point, I spent quite some time to make it work initially. As far as I remember, our Windows and Mac versions also ship a bundled JDK that is version 17 or similar.

Please try to move all the "opens" stuff to the pom.xml file (just search for "opens" in the file). Everything there gets applied to all platforms and not just Linux.

Then please try if the -D ... option is really needed. If yes then it probably needs to be added in three places - Linux, Mac and Windows Launcher.

mgmax commented 1 year ago

Can you please double-check if it is really broken with Java 17? Your commandline output in the issue report looks like from an older version. The latest VisiCut searches for the correct Java version and warns if it cannot find Java 11 or 17. https://github.com/t-oster/VisiCut/commit/540595a1cdf42976efaa1c1b25dcbcdbb7530ff2

TheAssassin commented 11 months ago

VisiCut works fine with the Java bundled in the AppImages, as far as I can tell, which is a prebuilt JVM found in https://github.com/adoptium/temurin17-binaries. I'd consider that the "reference environment" because the AppImage works on a majority of distributions.

The JAR built by distribute.sh also works (locally) on my workstation with OpenJDK 19. Same goes for https://download.visicut.org/files/master/All/VisiCut-1.9-209-g4df13952.zip. I checked the latter in an Ubuntu 22.04 VM as well. In both cases, I used the provided launch script.

mgmax commented 11 months ago

I can't reproduce the issue:

--> Closing as not reproducible.