A HTTP 500 error is thrown after trying to access Space Tools -> Content Tools in the browser.

お困りですか?

アトラシアン コミュニティをご利用ください。

コミュニティに質問

   

プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。

このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。

*Fisheye および Crucible は除く

要約

After an upgrade to Confluence Server or Data Center v7.19.18 (or newer), whenever the SPACE TOOLSCONTENT TOOLS option is selected for a space (/pages/templates2/listpagetemplates.action?key=<spacekey>), there is an HTTP 500 error thrown in the browser.

環境

Confluence Server or Data Center 7.19.18 or newer.

診断

By default, all HTTP 500 errors are logged in the <confluence-home>/logs/atlassian-log.log files. Upon inspecting the log files after the error is thrown, you will see the following stack (among other decorator type errors):

--------------------------
Parameters
--------------------------
key : TEST
src : spacetools
caused by: java.lang.RuntimeException: javax.servlet.ServletException: java.lang.RuntimeException: Error rendering template for decorator space
at com.opensymphony.sitemesh.webapp.decorator.BaseWebAppDecorator.render(BaseWebAppDecorator.java:37)
caused by: javax.servlet.ServletException: java.lang.RuntimeException: Error rendering template for decorator space
at com.atlassian.confluence.util.profiling.ConfluenceSitemeshDecorator$ErrorSendingErrorHandlingStrategy.handleException(ConfluenceSitemeshDecorator.java:279)
caused by: java.lang.RuntimeException: Error rendering template for decorator space
at com.atlassian.confluence.setup.velocity.ApplyDecoratorDirective.render(ApplyDecoratorDirective.java:162)
caused by: org.apache.velocity.exception.MethodInvocationException: Invocation of method 'getDisplayableLabel' in  class com.atlassian.confluence.impl.plugin.web.readonly.ReadOnlyWebLabel threw exception java.lang.NullPointerException at /templates/link-browser-web-items.vm[line 5, column 33]
at org.apache.velocity.runtime.parser.node.ASTMethod.handleInvocationException(ASTMethod.java:342)
caused by: java.lang.NullPointerException
at java.base/java.util.HashMap.putMapEntries(HashMap.java:497)

原因

In Confluence, we use decorator engines to generate the UI elements and layouts on a space and page level. This allows customization of these elements through custom layouts and templates that a space administrator can modify.

When navigating to SPACE TOOLSCONTENT TOOLS in your browser, the default landing page for this endpoint is SPACE TOOLSCONTENT TOOLS → TEMPLATES. This page takes you to the templates at the space and global level, however, in this scenario, there aren't any space or global templates defined (it's default) so we know the issue isn't with templates.

When the SPACE TOOLSCONTENT TOOLS → TEMPLATES page loads, it also loads the customized layout for that space, which can be found on SPACE TOOLS → LOOK AND FEEL → LAYOUT → CONTENT LAYOUT → SPACE LAYOUT and this is where we find our issue.

Under SPACE LAYOUT, you have a defined layout for that space and if it's customized, under the 'Operator' column you'll see the options to EDIT, RESET DEFAULT or VIEW DEFAULT. If it's set to default it'll state that it's <default>.

ソリューション

The issue lies with the customized layout code which is missing a portion of code found in the default layout code. 

To check, while on the affected space, navigate to SPACE TOOLS → LOOK AND FEEL → LAYOUT:

  1. Find SPACE LAYOUT under CONTENT LAYOUT
  2. Click the VIEW DEFAULT operator for SPACE LAYOUT, copy this code into a text editor.
  3. Click the EDIT operator next and copy this code into a text editor.
  4. Compare the two, making sure that all of the default layout code also exists in the custom layout code.

For this particular scenario, the customized layout code was missing specific context (webInterfaceContext) code found in the default layout, which caused a NullPointerException (NPE) whenever the hashmap was trying to find the context during loading of the page (in this case, since the context is missing, the application changes the context to default and this is where the null pointer exists). The following code needs to be set after line 58 in the customized layout code (click EDIT for the space layout):

#if (!$webInterfaceContext)
     #set ($webInterfaceContext = $action.webInterfaceContext)
#end

If you have any issues adding this code, copy your customized layout code to a text editor and reset the space layout to DEFAULT. Once it's working again, work to reintroduce your customized changes to a new layout, one at a time, and check the SPACE TOOLSCONTENT TOOLS → TEMPLATES again each time to see where it breaks and adjust accordingly.


最終更新日: 2024 年 2 月 23 日

この内容はお役に立ちましたか?

はい
いいえ
この記事についてのフィードバックを送信する
Powered by Confluence and Scroll Viewport.