MonkeyWrench/Assimp Error Loading GLTF Models

I am encountering this error when loading a gltf/glb models with MonkeyWrench 0.6.2:

Libbulletjme version 21.2.1 initializing
Mar 22, 2025 4:03:20 PM com.jme3.app.LegacyApplication handleError
SEVERE: Uncaught exception thrown in Thread[#36,jME3 Main,5,main]
java.lang.NoSuchFieldError: Class org.lwjgl.assimp.AIScene does not have member field 'sun.misc.Unsafe UNSAFE'
	at org.lwjgl.assimp.AIScene.nmNumMaterials(AIScene.java:444)
	at org.lwjgl.assimp.AIScene.mNumMaterials(AIScene.java:175)
	at com.github.stephengold.wrench.AssetBuilder.<init>(AssetBuilder.java:163)
	at com.github.stephengold.wrench.LwjglAssetLoader.loadScene(LwjglAssetLoader.java:148)
	at com.github.stephengold.wrench.LwjglAssetLoader.load(LwjglAssetLoader.java:95)
	at com.jme3.asset.DesktopAssetManager.loadLocatedAsset(DesktopAssetManager.java:274)
	at com.jme3.asset.DesktopAssetManager.loadAsset(DesktopAssetManager.java:390)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:441)
	at com.jme3.asset.DesktopAssetManager.loadModel(DesktopAssetManager.java:446)
	at codex.swordgame.GameApplication.simpleInitApp(GameApplication.java:34)
	at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:240)
	at com.jme3.system.lwjgl.LwjglWindow.initInThread(LwjglWindow.java:688)
	at com.jme3.system.lwjgl.LwjglWindow.run(LwjglWindow.java:791)
	at java.base/java.lang.Thread.run(Thread.java:1575)

This particular attempt was loading a glb file that contains blender’s default cube with no export settings changed. I’ve tried several things, like disabling material export in blender, but I’m always getting this same error.

Edit: Just tried FBX, STL, PLY, and OBJ and got the same error each time. I expect this occurs with all supported formats.

Edit: I switched from jme version 3.8-alpha4 to 3.8-alpha2 (alpha3 artifacts didn’t work for me, for some reason) and issue went away, so this may actually be a regression between alpha4 and alpha2.

1 Like

LWJGL3 was updated maybe in that version span. But also what Java version you are using? Java unsafe stuff might have been deleted (or do they need the flags to allow the usage) already in newer Java versions.

2 Likes

I think @tonihele is on the correct track: you’ll need a custom build of MonkeyWrench to use it with 3.8.0-alpha3 or -alpha4.

I’ve been testing with the JME alphas, but haven’t published yet. As soon as there’s a JME v3.8.0-stable, I’ll publish a new release of MonkeyWrench.

3 Likes

@tonihele
Yes, it looks like sgold upgraded lwjgl from 3.3.4 to 3.3.6 for alpha4. I’m using Java 23, but I’d expect Java to simply deprecate Unsafe rather than removing it altogether.

@sgold
Gotcha, I will temporarily revert to 3.7 for this project in the meantime.

1 Like