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
On 27 Jan 2015 at 11:34:04, Bryn Jeffries
(bryn.jeffries@sydney.edu.au(mailto:bryn.jeffries@sydney.edu.au)) wrote:
I tried to follow the example code given in:
http://extensions.xwiki.org/xwiki/bin/view/Extension/Create+a+component+usi…
Saving and Viewing a page with the code without changes, I got a Groovy macro error with
the following exception in the stack trace:
java.lang.RuntimeException: The Context Component Manager should only be used for read
access. Write operations should be done against specific Component Managers.
Could anyone explain what this means, and why this error now appears? I'm using 6.3.
I notice that the same error also currently shows up at
http://platform.xwiki.org/xwiki/bin/view/SRD/ running 6.2.2
Thanks,
Bryn