[CONTTAGS-139] Port to master: MgnlContext is not set for this thread Created: 31/Aug/23 Updated: 06/Sep/23 Resolved: 06/Sep/23 |
|
| Status: | Closed |
| Project: | Content Tags |
| Component/s: | None |
| Affects Version/s: | 3.0.0 |
| Fix Version/s: | 3.0.0 |
| Type: | Bug | Priority: | Normal |
| Reporter: | Richard Gange | Assignee: | ricardo gonzalez |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | None | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||
| Template: |
|
||||||||
| Acceptance criteria: |
Empty
|
||||||||
| Task DoD: |
[X]*
Doc/release notes changes? Comment present?
[X]*
Downstream builds green?
[X]*
Solution information and context easily available?
[X]*
Tests
[X]*
FixVersion filled and not yet released
[X] 
Architecture Decision Record (ADR)
|
||||||||
| Bug DoR: |
[X]*
Steps to reproduce, expected, and actual results filled
[X]*
Affected version filled
|
||||||||
| Date of First Response: | |||||||||
| Epic Link: | AuthorX Support | ||||||||
| Story Points: | 1 | ||||||||
| Team: | |||||||||
| Work Started: | |||||||||
| Approved: |
Yes
|
||||||||
| Description |
|
When a node is created the MgnlContext is used to find out the current user so that this can be entered in "mgnl:createdBy". Since this EventListener is asynchronous it is detached from the request and there is no MgnlContext. This then leads to the following error: 2023-02-23 12:17:32,611 ERROR info.magnolia.context.MgnlContext : MgnlContext is not initialized. This could happen if the request does not go through the Magnolia default filters. java.lang.IllegalStateException: MgnlContext is not set for this thread Reproduce
Expected Actual INFO info.magnolia.publishing.receiver.operation.jcr.JcrPublicationOperation 22.05.2023 13:16:34 -- About to update content under path [/magnolia-travels/Vietnam--Tradition-and-Today]. INFO info.magnolia.publishing.transactional.receiver.operation.jcr.JcrTransactionPublicationOperation 22.05.2023 13:16:34 -- 608 User superuser successfully published tours:/magnolia-travels/Vietnam--Tradition-and-Today on ROOT. ERROR info.magnolia.context.MgnlContext 22.05.2023 13:16:35 -- MgnlContext is not initialized. This could happen if the request does not go through the Magnolia default filters. java.lang.IllegalStateException: MgnlContext is not set for this thread at info.magnolia.context.MgnlContext.getInstance(MgnlContext.java:282) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.context.MgnlContext.getUser(MgnlContext.java:91) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.wrapper.MgnlPropertySettingContentDecorator.getCurrentUserName(MgnlPropertySettingContentDecorator.java:728) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.wrapper.MgnlPropertySettingContentDecorator.updateLastModified(MgnlPropertySettingContentDecorator.java:622) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.wrapper.MgnlPropertySettingContentDecorator.updateLastModified(MgnlPropertySettingContentDecorator.java:627) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.wrapper.MgnlPropertySettingNodeWrapper.updateLastModified(MgnlPropertySettingNodeWrapper.java:262) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.wrapper.MgnlPropertySettingNodeWrapper.addNode(MgnlPropertySettingNodeWrapper.java:214) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.wrapper.DelegateNodeWrapper.addNode(DelegateNodeWrapper.java:129) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.addNode(ContentDecoratorNodeWrapper.java:131) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.audit.MgnlAuditLoggingContentDecoratorNodeWrapper.addNode(MgnlAuditLoggingContentDecoratorNodeWrapper.java:84) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.wrapper.DelegateNodeWrapper.addNode(DelegateNodeWrapper.java:129) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.decoration.ContentDecoratorNodeWrapper.addNode(ContentDecoratorNodeWrapper.java:131) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.wrapper.MagnoliaSessionContentDecorator$1.addNode(MagnoliaSessionContentDecorator.java:67) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.jcr.util.NodeUtil.createPath(NodeUtil.java:637) ~[magnolia-core-6.2.34.jar:?] at info.magnolia.contenttags.manager.TagManager.getOrCreate(TagManager.java:168) ~[magnolia-content-tags-core-2.0.4.jar:?] at info.magnolia.contenttags.manager.TagManager.getOrCreateTag(TagManager.java:162) ~[magnolia-content-tags-core-2.0.4.jar:?] at info.magnolia.contenttags.TagsModule.lambda$null$1(TagsModule.java:142) ~[magnolia-content-tags-core-2.0.4.jar:?] at info.magnolia.observation.DeferringEventListener$ObservationBasedDelayedExecutor$1.run(DeferringEventListener.java:102) [magnolia-core-6.2.34.jar:?] at info.magnolia.cms.util.DelayedExecutor$RunnableWrapper.run(DelayedExecutor.java:103) [magnolia-core-6.2.34.jar:?] at EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(Unknown Source) [concurrent-1.3.4.jar:?] at java.lang.Thread.run(Thread.java:829) [?:?] Notes |