User login exception

I have created a new role called retail and assigned to a new user but can not log in for this new user. however, when I assign admin role to this user, login is succeeded. It seems something is related to role but not sure. it is hosted in Jelastic cloud and here is catalina log as attached.login eror.txt (28.0 KB). NPE is thrown.

Thanks for your help CUBA team.

I think you modified the main screen of the application?
If so, then most likely the answer is in this line of the log:
com.haulmont.cuba.web.app.loginwindow.AppLoginWindow - Unable to login
java.lang.NullPointerException: null
at com.myapp.erp.web.mainwindow.ExtAppMainWindow.init(ExtAppMainWindow.java:65)

The debugger near line 65 in ExtAppMainWindow.java can give an answer.

1 Like

Thing is, i can use the same user to long in if it has different role assigned.

I have a denying role, if I assign this denying role to the user + another role (“retail”) where the user will have access to some menu, it doesn’t work. If the user is assigned with retail role only, it works. Therefore it seems something is not good in denying role.

Denying role: i have just defined denying type tole to this role, no menu deny or allow defined. Is that right?

Yes. Normally, a user with such role can log into the system but the menu will be empty. So in order to find the problem, look at ExtAppMainWindow.java:65 in your project.

1 Like

Hi Konstantin
Thank you, line 65 and few more lines after are to set the icon to standard menu as follow that works in normal course.

   sideMenu.getMenuItem("administration").setIcon("icons/wf-design-compile.png");

It seems that while I am denying menu is returning null value to those menu this exception is caused.

Now question is, how to load the icons only when the user has access to those menu or is there any other better approach to prevent this happening?

Mortoza

Hi Mortoza,

Obviously you can check the object returned by sideMenu.getMenuItem() and set an icon only if it is not null.

Thank you so much Konstantin for the hints. It helped resolving that as follows:

   if(sideMenu.getMenuItem("administration") !=null)
        sideMenu.getMenuItem("administration").setIcon("icons/wf-design-compile.png");