Legacy Knowledge Base
Published Jul. 2, 2025

A navigation menu can't be removed

Written By

Kanchan Bisht

How To articles are not official guidelines or officially supported documentation. They are community-contributed content and may not always reflect the latest updates to Liferay DXP. We welcome your feedback to improve How To articles!

While we make every effort to ensure this Knowledge Base is accurate, it may not always reflect the most recent updates or official guidelines.We appreciate your understanding and encourage you to reach out with any feedback or concerns.

Legacy Article

You are viewing an article from our legacy "FastTrack" publication program, made available for informational purposes. Articles in this program were published without a requirement for independent editing or verification and are provided"as is" without guarantee.

Before using any information from this article, independently verify its suitability for your situation and project.

Issue

  • A navigation menu cannot be deleted by the user. On a clean instance, the issue can be reproduced with the provided user's database. 

  • Steps To Reproduce:
    (i) Restore the attached DB to a Liferay 7.2 fix pack dxp-7 portal with MySQL 5.7
    (ii) Navigate to the Child Sites from the created site and locate the United States site (as mentioned by the user).
    (iii) Navigate to Site builder > Navigation menus
    (iv) Locate the "OLD__footer-about-us" menu
    (v) Click on the three dots on the right and click Delete
    Expected Results: The navigation menu is deleted.
    Actual Results: The menu is not deleted and the following exceptions appear on the logs. 
  • 2021-04-29 16:04:52.859 ERROR [http-nio-8080-exec-7][PortletServlet:119] javax.portlet.PortletException: java.lang.reflect.UndeclaredThrowableException javax.portlet.PortletException: java.lang.reflect.UndeclaredThrowableException at com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand.processAction(BaseMVCActionCommand.java:69) at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.callActionMethod(MVCPortlet.java:378) at com.liferay.portal.kernel.portlet.LiferayPortlet.processAction(LiferayPortlet.java:88) at com.liferay.portal.kernel.portlet.bridges.mvc.MVCPortlet.processAction(MVCPortlet.java:260) at com.liferay.portlet.internal.FilterChainImpl.doFilter(FilterChainImpl.java:77) at com.liferay.portal.kernel.portlet.PortletFilterUtil.doFilter(PortletFilterUtil.java:50) at com.liferay.portal.kernel.servlet.PortletServlet.service(PortletServlet.java:115) at javax.servlet.http.HttpServlet.service(HttpServlet.java:741) at org.eclipse.equinox.http.servlet.internal.registration.EndpointRegistration.service(EndpointRegistration.java:153) at org.eclipse.equinox.http.servlet.internal.servlet.ResponseStateHandler.processRequest(ResponseStateHandler.java:62) at org.eclipse.equinox.http.servlet.internal.context.DispatchTargets.doDispatch(DispatchTargets.java:120) at org.eclipse.equinox.http.servlet.internal.servlet.RequestDispatcherAdaptor.include(RequestDispatcherAdaptor.java:48) at com.liferay.portlet.internal.InvokerPortletImpl.invoke(InvokerPortletImpl.java:589) at com.liferay.portlet.internal.InvokerPortletImpl.invokeAction(InvokerPortletImpl.java:632) at com.liferay.portlet.internal.InvokerPortletImpl.processAction(InvokerPortletImpl.java:304) at ..........................................................................................................................................................................................................com.liferay.portal.kernel.portlet.bridges.mvc.BaseMVCActionCommand.processAction(BaseMVCActionCommand.java:61) ... 161 more Caused by: com.liferay.portal.kernel.exception.NoSuchGroupException: No Group exists with the primary key 1425519 at com.liferay.portal.service.persistence.impl.GroupPersistenceImpl.findByPrimaryKey(GroupPersistenceImpl.java:13329) at com.liferay.portal.service.persistence.impl.GroupPersistenceImpl.findByPrimaryKey(GroupPersistenceImpl.java:13345) at com.liferay.portal.service.impl.GroupLocalServiceImpl.getGroup(GroupLocalServiceImpl.java:1606) at sun.reflect.GeneratedMethodAccessor217.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:498) at .........................................................................................

Environment

  • Liferay DXP 7.2 fix pack 7

Resolution

  • This observed behavior isn't a bug, rather, the navigation menu is looking for a GroupID that doesn't exist.

  • The navigation menu will no longer appear after running the following groovy script, however, the user may need to clear the database cache for the change to take effect.

  • Navigate to the Control Panel → Server Administration → Script. Change the script type to Groovy and replace the code in the scripting console with the following:

  • import com.liferay.portal.kernel.dao.jdbc.DataAccess;
    import java.sql.Connection;
    import java.sql.PreparedStatement;
    
    try {
        Connection connection = DataAccess.getConnection();
    
        PreparedStatement prepareStatement =
           connection.prepareStatement(
                "delete from sitenavigationmenuitem " + 
                "where groupId  not in (select groupId from group_)");
    
        prepareStatement.executeUpdate();
    
        connection.commit();
    }
    catch (Throwable t) {
        out.println(t);
    

Additional Information

  • Please make ensure that a database backup is created beforehand and continue to maintain adequate backups in case a rollback is required.
  • We highly recommend testing the above-suggested approach in a lower environment and then moving it to production as per your discretion if you feel comfortable with it.
  • We have a channel called "Global Service Team" that works primarily in development and implementation.
Did this article resolve your issue ?

Legacy Knowledge Base