Uploaded image for project: 'Magnolia'
  1. Magnolia
  2. MAGNOLIA-4373

NPE when running scheduled job

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Critical Critical
    • 4.5.3
    • 4.5, 4.5.1, 4.5.2
    • admininterface
    • None

      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.

        Acceptance criteria

              fgrilli Federico Grilli
              fgrilli Federico Grilli
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD