[MAGNOLIA-4373] NPE when running scheduled job Created: 16/Apr/12  Updated: 24/May/12  Resolved: 17/Apr/12

Status: Closed
Project: Magnolia
Component/s: admininterface
Affects Version/s: 4.5, 4.5.1, 4.5.2
Fix Version/s: 4.5.3

Type: Bug Priority: Critical
Reporter: Federico Grilli Assignee: Federico Grilli
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Attachments: Text File stacktrace.txt    
Issue Links:
causality
Template:
Acceptance criteria:
Empty
Task DoD:
[ ]* Doc/release notes changes? Comment present?
[ ]* Downstream builds green?
[ ]* Solution information and context easily available?
[ ]* Tests
[ ]* FixVersion filled and not yet released
[ ]  Architecture Decision Record (ADR)
Bug DoR:
[ ]* Steps to reproduce, expected, and actual results filled
[ ]* Affected version filled

 Description   

This has been noticed when testing the demo activation job coming with the scheduler module after upgrading the latter to Magnolia 4.5. Here is the error

2012-04-16 16:32:00,001 INFO  info.magnolia.module.scheduler.CommandJob         : Starting job [demo]...
2012-04-16 16:32:00,004 ERROR olia.module.admininterface.commands.VersionCommand: can't version
java.lang.NullPointerException
	at info.magnolia.context.AbstractContext.getJCRSession(AbstractContext.java:134)
	at info.magnolia.context.MgnlContext.getJCRSession(MgnlContext.java:511)
	at info.magnolia.module.admininterface.commands.BaseRepositoryCommand.getNode(BaseRepositoryCommand.java:65)
	at info.magnolia.module.admininterface.commands.VersionCommand.execute(VersionCommand.java:75)
	at info.magnolia.commands.MgnlCommand.executePooledOrSynchronized(MgnlCommand.java:174)
	at info.magnolia.commands.MgnlCommand.execute(MgnlCommand.java:161)
	at org.apache.commons.chain.impl.ChainBase.execute(ChainBase.java:191)
	at info.magnolia.module.scheduler.CommandJob.execute(CommandJob.java:93)
	at org.quartz.core.JobRunShell.run(JobRunShell.java:223)
	at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:549)

The problem can be traced back to info.magnolia.module.admininterface.commands.BaseRepositoryCommand.getNode(Context) line #65 where the call to info.magnolia.cms.security.PermissionUtil.isGranted(Session, String, String) would get as a first param the current JCR session set in MgnlContext. Now, info.magnolia.module.scheduler.CommandJob s set the ctx as a info.magnolia.context.SimpleContext.SimpleContext whose repository strategy is not set by default, hence the NPE.



 Comments   
Comment by Federico Grilli [ 17/Apr/12 ]

reopening as another issue now has arisen concerning failure to retrieve versioned node in Inbox view. See attached stacktrace

Comment by Federico Grilli [ 17/Apr/12 ]

moved the uuid empty issue to MAGNOLIA-4374

Generated at Mon Feb 12 03:55:09 CET 2024 using Jira 9.4.2#940002-sha1:46d1a51de284217efdcb32434eab47a99af2938b.