Sealing violation with lwjgl3 -- anyone seen this before?

Hi everyone,

I’m still a newbie, and I’m still struggling with things which are probably obvious.
But if I don’t have lwjgl3 explicitly on my classpath I get

cc.journeyman.simulated-genetics.launcher=> (start app)
May 10, 2024 7:52:11 PM com.jme3.system.JmeSystemDelegate lambda$new$1
WARNING: JmeDialogsFactory implementation not found.
May 10, 2024 7:52:11 PM com.jme3.system.JmeDesktopSystem initialize
INFO: Running on jMonkeyEngine 3.6.1-stable
 * Branch: HEAD
 * Git Hash: 4de10c3
 * Build Date: 2023-06-23
May 10, 2024 7:52:11 PM com.jme3.system.JmeDesktopSystem newContextLwjgl
SEVERE: CRITICAL ERROR: Context class is missing!
Make sure jme3_lwjgl-ogl is on the classpath.
java.lang.ClassNotFoundException: com.jme3.system.lwjgl.LwjglDisplay

and if I do, I get

cc.journeyman.simulated-genetics.launcher=> May 21, 2024 2:00:38 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[jME3 Main,5,main]
java.lang.ExceptionInInitializerError
        at org.lwjgl.system.Pointer$Default.<clinit>(Pointer.java:67)
        at org.lwjgl.system.Callback.<clinit>(Callback.java:40)
        at com.jme3.system.lwjgl.LwjglWindow.createContext(LwjglWindow.java:231)
        at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:588)
        at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:710)
        at java.base/java.lang.Thread.run(Thread.java:840)
Caused by: java.lang.UnsupportedOperationException: java.lang.SecurityException: sealing violation: can't seal package org.lwjgl: already defined
        at org.lwjgl.system.MemoryUtil.<clinit>(MemoryUtil.java:130)
        ... 6 more
Caused by: java.lang.SecurityException: sealing violation: can't seal package org.lwjgl: already defined

Does this ring any bells with anyone?

Are you using Ant, Maven or Gradle? You should list your dependencies here for us to see.

Java version and target environment would also be useful.

Else my generic-but-probably-unhelpful advice is: turn off sealing.

I’m using leiningen, which I admit is probably not helpful!

(defproject simulated-genetics "0.1.0-SNAPSHOT"
  :cloverage {:output "docs/cloverage"
              :codecov? true
              :emma-xml? true}
  :codox {:froboz.cloverage {:output "docs/cloverage"
                             :codecov? true
                             :html? true
                             :debug? true}
          :metadata {:doc "**TODO**: write docs"
                     :doc/format :markdown}
          :output-path "docs/codox"
          :source-uri "https://github.com/simon-brooke/the-great-game/blob/master/{filepath}#L{line}"}
  :dependencies [[clj-python/libpython-clj "2.025"]
                 [com.taoensso/telemere "1.0.0-beta3"] ;; Peter Taoussanis' new replacement for Timbre
                 [jme-clj "0.1.13"]
                 [org.clojure/clojure "1.11.1"]
                 [org.clojure/tools.cli "1.1.230"]
                 [org.jmonkeyengine/jme3-core "3.6.1-stable"]
                 [org.jmonkeyengine/jme3-lwjgl3 "3.6.1-stable"]]
  :description "A lightweight simulation of genetics, intended for use in games only."
  :license {:name "GNU General Public License,version 2.0 or (at your option) any later version"
            :url "https://www.gnu.org/licenses/old-licenses/gpl-2.0.en.html"}
  :main ^:skip-aot cc.journeyman.simulated-genetics.launcher
  :plugins [[lein-cloverage "1.2.2"]
            [lein-codox "0.10.8"]]
  :target-path "target/%s"
  :profiles {:uberjar {:aot :all
                       :jvm-opts ["-Dclojure.compiler.direct-linking=true"]}}
  :url "http://example.com/FIXME")

The Git repository is here, if it helps.

2 Likes

JVM version is 17.0.10; full specification is

cc.journeyman.simulated-genetics.launcher=> (require '[com.widdindustries.tools.jvm :refer [jvm-deets]])
nil
cc.journeyman.simulated-genetics.launcher=> (select-keys (jvm-deets) [:spec-vendor :spec-name :vm-version])
{:spec-vendor "Oracle Corporation", :spec-name "Java Virtual Machine Specification", :vm-version "17.0.10+7-Debian-1deb12u1"}

Exploring further, I’m cribbing from the examples in @ertugrulcetin’s [jme-clj](https://github.com/ertugrulcetin/jme-clj/) repository, specifically this one. @ertugrulcetin’s dependencies are as follows:

(def jme-version "3.3.2-stable")

...
  :dependencies [[org.clojure/clojure "1.10.1"]
                 [org.jmonkeyengine/jme3-core ~jme-version]
                 [org.jmonkeyengine/jme3-plugins ~jme-version]
                 [org.jmonkeyengine/jme3-terrain ~jme-version]
                 [org.jmonkeyengine/jme3-jogg ~jme-version]
                 [org.jmonkeyengine/jme3-jogl ~jme-version]
                 [org.jmonkeyengine/jme3-effects ~jme-version]
                 [org.jmonkeyengine/jme3-desktop ~jme-version]
                 [org.jmonkeyengine/jme3-lwjgl ~jme-version]
                 [org.jmonkeyengine/jme3-niftygui ~jme-version]
                 [org.jmonkeyengine/jme3-networking ~jme-version]
                 [org.jmonkeyengine/jme3-blender ~jme-version]
                 [camel-snake-kebab "0.4.2"]
                 [com.github.stephengold/Minie "3.1.0"]
                 [kezban "0.1.92"]
                 [potemkin "0.4.5"]]

His code works.

I had tried to upgrade jme-version to 3.6.1-stable, but this failed because

  1. jme3-lwjgl-3.6.1-stable.pom references lwjgl, and
  2. both jme3-lwjgl-3.6.1-stable.pom and lwjgl/2.9.5/lwjgl-2.9.5.pom reference lwjgl-platform; but
  3. although the POM for lwjgl-platform-2.9.5 exists in public repositories, there’s no related JAR file (and actually the manifest in the POM does not advertise that there will be).

I found this apparently-related query, and tried the recommended fix of specifying JME version 3.7.0-SNAPSHOT; that did not exist in public repos, but 3.7.0-beta1 did. However, I then saw

Exception in thread "jME3 Main" java.lang.NoClassDefFoundError: com/jme3/system/NativeLibraries

This query appeared relevant, so I added the jbullet dependency, but the stack-alloc.jar file doesn’t exist in the 3.7 branch of the git repository; so for the time being I’m once again stuck.


OK, if I reset all JME3 dependency versions to 3.3.2, I get no further errors. Attempting to load a .glb file created with @sgold’s Maud results in an instance of com.jme3.scene.Node being created, and although I’m not yet seeing it in the scene (possibly because of lighting problems?), I think this problem is mostly resolved.

I’d like to get to the point I can use current stable JME libraries with jme-clj, but that’s a separate problem!

The latest releases of stack-alloc are available from Maven Central:

1 Like