Nifty popup nullpointer exception

using nifty via maven, I think its nifty-1.3.3

<dependency>
	<groupId>com.jme3</groupId>
	<artifactId>jme3-niftygui</artifactId>
	<version>3.0.10</version>
</dependency>

<?xml version="1.0" encoding="UTF-8"?>
<nifty>
  <screen id="shop" controller="de.its.anonymous.ShopController">
    <layer id="layer" childLayout="center">     
    	<panel id="shopbase" width="100%" height="100%" childLayout="absolute-inside">
       		<control id="sale" name="button" align="center" valign="center" label="Sell collected resources" x="90%" y="85%" width="15%" height="4%">
      			<interact onClick="sale()"/>
       		</control>
       		<control id="backToMainView" name="button" align="center" valign="center" label="Back to Main-View" x="90%" y="90%" width="15%" height="4%">
      			<interact onClick="backToMainView()"/>
       		</control>
       	</panel>
     </layer>
     <popup id="popupSpaceshipName" childLayout="absolute-inside">
 		<panel id="panelSpaceshipName" width="100%" height="100%" childLayout="absolute-inside">
			<control id="textFieldSpaceshipName" name="textfield" align="center" valign="center"  x="20%" y="20%" width="70%" height="60%"/>
    		<control id="buttonSpaceshipName" name="button" align="center" valign="center" label="Finish" x="90%" y="85%" width="15%" height="4%">
    			<interact onClick="commit()"/>
    		</control>
    	</panel>
  	</popup> 
  </screen>
</nifty>

Element element = nifty.createPopup("popupSpaceshipName");

And then I get a huge stacktrace. I think the problem is that my PopupId (createPopup(id)) is used for popupType, for whatever reason. Obviously I have no idea how to do it right. And yes I did read nifty-gui-the-manual 42-44. I’m not sure about the thing that I create here a popup but the xml should do it anyway or? What is with register it? Help?

Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker callMethod
WARNUNG: Exception: java.lang.reflect.InvocationTargetException
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: sun.reflect.NativeMethodAccessorImpl invoke0 (NativeMethodAccessorImpl.java:-2)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: sun.reflect.NativeMethodAccessorImpl invoke (NativeMethodAccessorImpl.java:62)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: sun.reflect.DelegatingMethodAccessorImpl invoke (DelegatingMethodAccessorImpl.java:43)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: java.lang.reflect.Method invoke (Method.java:483)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.NiftyMethodInvoker callMethod (NiftyMethodInvoker.java:145)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.NiftyMethodInvoker performInvoke (NiftyMethodInvoker.java:91)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty$DelayedMethodInvoke perform (Nifty.java:1174)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty invokeMethods (Nifty.java:1152)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty handleDynamicElements (Nifty.java:354)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty access$1700 (Nifty.java:77)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl processEvent (Nifty.java:1374)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl processMouseEvent (Nifty.java:1329)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.niftygui.InputSystemJme handleMouseEvent (InputSystemJme.java:169)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.niftygui.InputSystemJme onMouseButtonEventQueued (InputSystemJme.java:232)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.niftygui.InputSystemJme forwardEvents (InputSystemJme.java:296)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty update (Nifty.java:288)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.niftygui.InputSystemJme endInput (InputSystemJme.java:113)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.input.InputManager processQueue (InputManager.java:819)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.input.InputManager update (InputManager.java:883)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.app.Application update (Application.java:604)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.app.SimpleApplication update (SimpleApplication.java:231)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.system.lwjgl.LwjglAbstractDisplay runLoop (LwjglAbstractDisplay.java:151)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.system.lwjgl.LwjglDisplay runLoop (LwjglDisplay.java:185)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.system.lwjgl.LwjglAbstractDisplay run (LwjglAbstractDisplay.java:228)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: java.lang.Thread run (Thread.java:745)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: Root Cause: java.lang.NullPointerException
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.loaderv2.types.XmlBaseType <init> (XmlBaseType.java:15)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.loaderv2.types.ElementType <init> (ElementType.java:40)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.loaderv2.types.PopupType <init> (PopupType.java:14)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty createPopupFromType (Nifty.java:874)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty createAndAddPopup (Nifty.java:927)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty createPopup (Nifty.java:902)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.anonymous.ShopController buy (ShopController.java:130)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: sun.reflect.NativeMethodAccessorImpl invoke0 (NativeMethodAccessorImpl.java:-2)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: sun.reflect.NativeMethodAccessorImpl invoke (NativeMethodAccessorImpl.java:62)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: sun.reflect.DelegatingMethodAccessorImpl invoke (DelegatingMethodAccessorImpl.java:43)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: java.lang.reflect.Method invoke (Method.java:483)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.NiftyMethodInvoker callMethod (NiftyMethodInvoker.java:145)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.NiftyMethodInvoker performInvoke (NiftyMethodInvoker.java:91)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty$DelayedMethodInvoke perform (Nifty.java:1174)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty invokeMethods (Nifty.java:1152)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty handleDynamicElements (Nifty.java:354)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty access$1700 (Nifty.java:77)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl processEvent (Nifty.java:1374)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty$NiftyInputConsumerImpl processMouseEvent (Nifty.java:1329)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.niftygui.InputSystemJme handleMouseEvent (InputSystemJme.java:169)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.niftygui.InputSystemJme onMouseButtonEventQueued (InputSystemJme.java:232)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.niftygui.InputSystemJme forwardEvents (InputSystemJme.java:296)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: de.lessvoid.nifty.Nifty update (Nifty.java:288)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.niftygui.InputSystemJme endInput (InputSystemJme.java:113)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.input.InputManager processQueue (InputManager.java:819)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.input.InputManager update (InputManager.java:883)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.app.Application update (Application.java:604)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.app.SimpleApplication update (SimpleApplication.java:231)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.system.lwjgl.LwjglAbstractDisplay runLoop (LwjglAbstractDisplay.java:151)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.system.lwjgl.LwjglDisplay runLoop (LwjglDisplay.java:185)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: com.jme3.system.lwjgl.LwjglAbstractDisplay run (LwjglAbstractDisplay.java:228)
Jun 18, 2015 12:06:36 PM de.lessvoid.nifty.NiftyMethodInvoker logException
WARNUNG: java.lang.Thread run (Thread.java:745)

For those who use nifty and might be able to help you, the stack trace is probably critical. An exception with a stack trace is like getting a hood ornament instead of a car… completely useless.

…and if the stack trace leads to your own code then you need to include that code, too.

its on the way sir, there is a bug with this forum and chrome I think when editing my post.

The forum is having issues and goes through periods where it seems to reject 50-60% of requests for a while. Sometimes just retrying is all that’s needed.

Yes I’ve also just realized. Stacktrace is up in start post

Hi,

Popups may not be defined inside the screen tag.
I recommend you import the .xsd in the head of your xml files, then your IDE can give you this information. (Tested with IntelliJ IDEA 14.x)

You say you use Nifty 1.3.x, so your nifty header should probably be the same as our :smile:

<nifty xmlns="http://nifty-gui.sourceforge.net/nifty-1.3.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://nifty-gui.sourceforge.net/nifty-1.3.xsd http://nifty-gui.sourceforge.net/nifty-1.3.xsd"> 
    <popup id="your-popup" >
        <!-- Your Popup XML -->
    </popup>
    <screen id="your-screen">
        <!-- Your Screen XML -->
    </screen>
</nifty>