JME3 on Netbeans Platform: Exception when trying to close

Hello all!
I discovered JME and have to say, I absolutely love it! Now I try to get JME running stable on the Netbeans Platform (like the JME SDK does it), with no fancy stuff for a start.

So I extend a SimpleAmplication, instantiate and initialize it and attach its canvas to a JPanel and the panel to a TopComponent (a window in the Netbeans Platform).

But if I try to close the Netbeans application, the app freezes. It also does when I try to close the TopComponent window, even if I just call SimpleApplication.stop() from somewhere.

That’s the exception I always get:

SEVERE []: Uncaught exception thrown in Thread[LWJGL Renderer Thread,6,IDE Main] java.lang.AssertionError at com.jme3.util.NativeObjectManager.deleteAllObjects( at com.jme3.renderer.lwjgl.LwjglRenderer.cleanup( at com.jme3.system.lwjgl.LwjglCanvas.destroyContext( at com.jme3.system.lwjgl.LwjglCanvas.pauseCanvas( at com.jme3.system.lwjgl.LwjglCanvas.runLoop( at [catch] at BUILD STOPPED (total time: 35 seconds)

Here’s my SimpleApplication:

public class AppTry extends SimpleApplication {

private static AppTry uniqueApp = null;
private static Canvas mainCanvas = null;
private static JmeCanvasContext canvasContext = null;

protected AppTry() {/*Defeat instantiation*/}

public static AppTry getUniqueApp() {
    if (uniqueApp == null) {
        uniqueApp = new AppTry();
    return uniqueApp;

public void simpleInitApp() {
    attachWireBox(Vector3f.ZERO, 1.0f, ColorRGBA.Blue, rootNode);

public static Canvas getMainCanvas() {
    if (mainCanvas == null) {
        AppSettings settings = new AppSettings(true);
        mainCanvas = getMainCanvasContext().getCanvas();
    return mainCanvas;

public static AppTry getUniqueApp() {
    if (uniqueApp == null) {
        uniqueApp = new AppTry();
    return uniqueApp;

public void attachWireBox(Vector3f pos, float size, ColorRGBA color, Node attachTo) {
    putShape(new WireBox(size, size, size), "Wireframe Cube", color, pos, attachTo);

private Geometry putShape(Mesh shape, String shapeName, ColorRGBA color, Vector3f position, Node attachTo) {
    Geometry g = new Geometry(shapeName, shape);
    Material mat = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
    mat.setColor("Color", color);
    return g;

public void stop() {
    mainCanvas = null;
    canvasContext = null;

public void stop(boolean waitFor) {
    mainCanvas = null;
    canvasContext = null;


And here’s the TopComponent:


  • Top component which displays something.
    preferredID = “JmeTestTopComponent”,
    persistenceType = TopComponent.PERSISTENCE_ALWAYS)
    @TopComponent.Registration(mode = “editor”, openAtStartup = false)
    @ActionID(category = “Window”, id = “org.jmetest.JmeTestTopComponent”)
    @ActionReference(path = “Menu/Window” /
    , position = 333 */)
    displayName = “#CTL_JmeTestAction”,
    preferredID = “JmeTestTopComponent”)
    “CTL_JmeTestTopComponent=JmeTest Window”,
    “HINT_JmeTestTopComponent=This is a JmeTest window”
    public final class JmeTestTopComponent extends TopComponent {

    private static SimpleApplication simApp;
    private static Canvas canvas;

    public JmeTestTopComponent() {

     simApp = AppTry.getUniqueApp();
     canvas = AppTry.getMainCanvas();
     jPanelCanvas.setMinimumSize(new java.awt.Dimension(10, 10));
     jPanelCanvas.setLayout(new BorderLayout());
     jPanelCanvas.add(canvas, BorderLayout.CENTER);


    private void initComponents() {
    // Swing compontent initialization

    private void jButtonKillActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonKillActionPerformed
    simApp.enqueue(new Callable<Void>() {
    public Void call() throws Exception {
    return null;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton jButtonKill;
    private javax.swing.JPanel jPanelBar;
    private javax.swing.JPanel jPanelCanvas;
    private javax.swing.JToolBar jToolBar;
    // End of variables declaration//GEN-END:variables

    public void componentOpened() {
    // super.componentOpened();

    public void componentClosed() {
    // super.componentClosed();
    // simApp.stop(true);

As you can see, I tried simApp.stop(true) in the componentClosed() method. I also tried calling stop() within a callable with simApp.enque(…). The error also occurs if I didn’t attach anything to the root node.

I also looked into and (from the JME SDK Core module sources), where a JME3 canvas also gets integrated into a TopComponent of the Netbeans Platform, but I couldn’t find what I should do differently when closing the application.

Do you see why it freezes when I try to close and how to prevent it, am I missing something? Or have you got some pointers on how to cleanly integrate JME3 into the Netbeans Platfrom?

Thank you for reading!

(Some side info: jME3_2013-05-26, Netbeans 7.3.1, JRE 1.7_21 on Win8 running in x86)

With different JME3 libraries it suddenly works!

Closing window or calling simpleApplication.stop():
jME3_2013-05-01: works fine
jME3_2013-05-26: AssertionError at com.jme3.util.NativeObjectManager.deleteAllObjects(

Builds from here.

The issue was fixed June 1st:


Thank you!

@Momoko_Fan said: The issue was fixed June 1st:

Is there any chance of getting the fixed code uploaded to ? They seemed to stop updating after May 26th,

@stemkoski said: Is there any chance of getting the fixed code uploaded to ? They seemed to stop updating after May 26th,
go here:

Just what I was looking for, thanks for the link!