On 27 Jan 2015 at 12:14:28, Bryn Jeffries
(bryn.jeffries@sydney.edu.au(mailto:bryn.jeffries@sydney.edu.au)) wrote:
Thanks Vincent,
Using Utils.getRootComponentManager() worked for me, so many thanks. Even using a
deprecated method lets me progress with the task.
The recommended way is the one I’ve now documented
at
http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAcce…
Thanks
-Vincent
Bryn
From: Vincent Massol [vmassol(a)gmail.com] on behalf of vincent(a)massol.net
[vincent(a)massol.net]
Sent: 27 January 2015 21:55
To: XWiki Users
Cc: Bryn Jeffries
Subject: Re: [xwiki-users] Error: The Context Component Manager should only be used for
read access.
Hi Bryn,
Apparently we broke backward compat and this is bad… We used to return the root Component
Manager when calling Utils.getComponentManager()
But it’s been modified and deprecated in XWiki 6.1M1
(
http://jira.xwiki.org/browse/XWIKI-10352) to return the Context Component Manager.
Now, the new way of registering components has been to use the Component Manager script
service introduced in XWiki 4.1M2 (see
http://extensions.xwiki.org/xwiki/bin/view/Extension/Component+Module#HAcce…).
However I’ve just noticed that it’s also been modified to return the Context CM instead
of the Root CM.
This means there’s now no way to dynamically register a new component from Groovy without
using a deprecated API…
So right now the only workaround is to use the deprecated method:
Utils.getRootComponentManager()
I’ve created
http://jira.xwiki.org/browse/XWIKI-11716
Thanks
-Vincent