legacy-knowledge-base
公開されました Jul. 2, 2025

ナビゲーション メニューは削除できません

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

learn-legacy-article-disclaimer-text

問題

  • ユーザーがナビゲーション メニューを削除することはできません。 クリーンなインスタンスでは、提供されたユーザーのデータベースで問題を再現できます。

  • 再現手順:
    (i) MySQL 5.7 を使用して、接続された DB を Liferay 7.2 フィックスパック dxp-7 ポータルに復元します。
    (ii) 作成したサイトから子サイトに移動し、米国のサイトを見つけます (ユーザー)。
    (iii) サイト ビルダーに移動します。 > ナビゲーション メニュー
    (iv) 「OLD__footer-about-us」メニューを見つけます。
    (v) 右側の 3 つのドットをクリックし、[削除] をクリックします。
    予想される結果: ナビゲーション メニューは次のとおりです。削除されました。
    実績: メニューは削除されず、次の例外がログに表示されます。
  • 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 フィックスパック 7

解決策

  • この観察された動作はバグではなく、ナビゲーション メニューが存在しない GroupID を探しています。

  • 次の groovy スクリプトを実行すると、ナビゲーション メニューは表示されなくなりますが、変更を有効にするには、ユーザーがデータベース キャッシュをクリアする必要がある場合があります。

  • N コントロール パネルサーバー管理スクリプトに移動します。 スクリプト タイプを Groovy に変更し、スクリプト コンソールのコードをのように置き換えます。

  • 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);
    

追加情報

  • データベースのバックアップが事前に作成されていることを確認し、ロールバックが必要な場合に備えて引き続き適切なバックアップを維持してください。
  • 上記で提案したアプローチを下位の環境でテストし、問題がなければ、自分の判断で本番環境に移行することを強くお勧めします。
  • 「グローバル サービス チーム」 というチャンネルがあり、主に開発と実装を担当しています。
did-this-article-resolve-your-issue

legacy-knowledge-base