Null pointer exception when attaching custom appstate

Word of advice…

Don’t ever set yourself up for subtle problems like that. Use the same case if you want to use the same name… then if you want to refer to the local instance variable over the parameter:
this.app = (MainCallingClass)app;

You’ve bit off a big chunk while trying to learn Java and 3D and JME all at once. Like learning to ride a bike and shave at the same time.

Some more words of advice for asking for help:

  1. don’t mention an exception unless you provide the stack trace. The name of the exception is the least important information and is only one step above saying “there is a problem”.
  2. https://hub.jmonkeyengine.org/t/how-to-type-code-blocks