getMainWindow() throws NullPointerException

Hi everybody,

everytime i try to use the getMainWindow() - Method, a NPE is thrown :frowning:

Here is my code:


an the init method:

public class MyApplication extends Application{
private static ThreadLocal<MyApplication> threadLocal = new ThreadLocal<MyApplication>();

public void init(){
        Window w = new Window();

public static MyApplication getInstance() {
     return threadLocal.get();

public static void setInstance(MyApplication application) {

Did you also implement the TransactionListener as described

your my man… i´ve used another code snippet without these transactionlistner part. now it works so far.

the part:


must bei changed to


is that ok?

I think you actually don’t need the locale part at all because i think in the example they use another threadlocal called Lang.which you don’t have. It also seems like the top example is outdated and it is recommended to use the bottom one with HttpServletRequestListener.

ok thanks for your help :smiley: