Plugin Operation Failed with Velocity ParseErrorException
プラットフォームについて: Data Center - この記事は、Data Center プラットフォームのアトラシアン製品に適用されます。
このナレッジベース記事は製品の Data Center バージョン用に作成されています。Data Center 固有ではない機能の Data Center ナレッジベースは、製品のサーバー バージョンでも動作する可能性はありますが、テストは行われていません。サーバー*製品のサポートは 2024 年 2 月 15 日に終了しました。サーバー製品を利用している場合は、アトラシアンのサーバー製品のサポート終了のお知らせページにて移行オプションをご確認ください。
*Fisheye および Crucible は除く
症状
Certain plugin operations always fail with a ParseErrorException as below, both in the browser and in the
atlassian-confluence.log
:Sample error from the Copy Space plugin2011-02-01 17:21:16,485 ERROR [TP-Processor22] [opensymphony.webwork.dispatcher.VelocityResult] doExecute Unable to render Velocity Template, '/templates/extra/copyspace/copyspaceoptions.vm' -- space: 9633795 | url: /spaces/copyspaceoptions.action | userName: mbuford | referer: http://mfwiki.mfoundry.com/spaces/spacepermissions.action?key=MB22 | action: copyspaceoptions org.apache.velocity.exception.ParseErrorException: Invalid arg #0 in directive #bodytag/templates/extra/copyspace/copyspaceoptions.vm[line 36, column 21] at org.apache.velocity.Template.process(Template.java:141) at com.atlassian.confluence.util.velocity.ConfigurableResourceManager.loadResource(ConfigurableResourceManager.java:363) at com.atlassian.confluence.util.velocity.ConfigurableResourceManager.getResource(ConfigurableResourceManager.java:304) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1400) at org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:1380) at org.apache.velocity.app.VelocityEngine.getTemplate(VelocityEngine.java:401) at com.opensymphony.webwork.dispatcher.VelocityResult.getTemplate(VelocityResult.java:146)
- The plugin is installed by placing it in
<confluence install>/confluence/WEB-INF/lib
folder
原因
The plugin is not compatible with the latest version of Velocity, and it is avoiding the compatibility layer provided for plugins installed in the regular way (through the UI).
According to Migrating to Velocity 1.5 the version of Velocity used since Confluence 2.8 does not accept the bodytag directive's syntax below because the first argument TextField
is not surrounded in quotes. However, plugins have a special resourceloader
applied that should fix the broken syntax. They are not applied to plugins loaded from WEB-INF/lib
for performance reasons.
Using the stack trace from the Copy Space plugin above as an example. The offending line was:
#bodytag( TextField "label='space-name'" "name='newName'" "size=40" )
回避策
This work around is provided only for educational purposes. Since it will cause a performance issue, please follow the advice provided in the Resolution section.
There is a compatibility layer configured in the velocity.properties
file. By default it includes this line:
confplugin.resource.loader.confluence.velocity13.compatibility=true
But if you install the plugin through WEB-INF/lib
it does not use the "confplugin"
resource loader, it uses the "confclass"
resource loader, which does not use the velocity13
compatibility mode.
If one very much wanted to run the plugin from WEB-INF/lib
, it can be done by extracting the velocity.properties
file from WEB-INF/lib/confluence.jar
and placing it in WEB-INF/classes
. Then adding this line:
confclass.resource.loader.confluence.velocity13.compatibility=true
ソリューション
- Confluence を停止します。
- Move the plugin out of the
WEB-INF/lib
directory - Confluence を再起動します。
- Go to Admin Console -> Plugins and upload the jar to the system. This will install the plugin into Confluence's database and it will have the compatibility layer applied.
関連コンテンツ