Unable to login IllegalArgumentException: MenuItem with this id already exists

I have IMAP add-on within my application which was running well until getting the following exception that seems to be due to admin menu Id conflicts.

com.haulmont.addon.imap.entity.ImapMessage - Convert imap flags [ImapFlag{systemFlag=null, name='myIMAP'}, ImapFlag{systemFlag=null, name='imap'}, ImapFlag{systemFlag=null, name='cuba-imap'}] to raw string 2019-01-02 06:06:02.908 INFO [http-nio-80-exec-1/myERP-core/server] com.haulmont.cuba.security.auth.AuthenticationManagerBean - Logged in: 225e8fc2-06a5-83bd-c5e4-fb04054bc1c1 [admin] 2019-01-02 06:06:02.909 DEBUG [http-nio-80-exec-1/myERP-core/admin] com.haulmont.cuba.core.app.RdbmsStore - commit: commitInstances=[com.haulmont.cuba.security.entity.SessionLogEntry-8235d4df-f1a1-8d44-c8d0-82b6b241affb [new]], removeInstances=[] 2019-01-02 06:06:02.917 DEBUG [http-nio-80-exec-1/myERP/admin] com.haulmont.cuba.web.DefaultApp - connectionStateChanged connected: true, authenticated: true 2019-01-02 06:06:02.918 DEBUG [http-nio-80-exec-1/myERP/admin] com.haulmont.cuba.web.App - Closing all windows 2019-01-02 06:06:02.918 DEBUG [http-nio-80-exec-1/myERP/admin] com.haulmont.cuba.web.DefaultApp - Session reinitialized: HttpSession=org.apache.catalina.session.StandardSessionFacade@62d5ca4a, timeout=1800sec, UserSession=225e8fc2-06a5-83bd-c5e4-fb04054bc1c1 [admin] 2019-01-02 06:06:02.956 WARN [http-nio-80-exec-1/myERP/admin] com.haulmont.cuba.web.app.loginwindow.AppLoginWindow - Unable to login java.lang.IllegalArgumentException: MenuItem with this id already exists at com.haulmont.cuba.web.gui.components.mainwindow.WebSideMenu.checkItemIdDuplicate(WebSideMenu.java:151) ~[cuba-web-6.10.6.jar:6.10.6]

Any suggestions to overcome this issue?

Why do you think the problem is related to the IMAP add-on?

Hi Konstantin
It seemed to me based on exception but noticed now that the root cause could be something else! It appears that the Admin menu ID is conflicted! Where and how should i find out the root cause for a fix?

Unfortunately, the duplicated id is not shown in the log. It’s our fault and we’ll fix it in the next update.
In order to find out what menu item causes the problem, restart the server, set a breakpoint to the line 151 of WebSideMenu class, connect with the debugger and try to log in to the system. You will see the value of id argument in the debugger.

Ok.
I just tried with setting a breakpoint to the line 151, i could see different menu names one by one and found the menu item which is duplicate!! Now resolved. Thank you so much Konstantin. I have been trying to resolve last few days and now can breath well!! Thank you again.

In such case, we could have this in the Studio:

  • Restrict using a browse screen more than one. generally it does but I don’t have any clue how it happened
  • Detect such duplicate menu item while Building the app. it was a browse screen called twice

regards
Mortoza