Uploaded image for project: 'Commenting (closed)'
  1. Commenting (closed)
  2. MGNLCMNT-103

PageCommentsNotification.ftl throws exception when retrieving page link

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 2.2.1
    • 2.2
    • None

      The PageCommentsNotification.ftl throws an exception when it tries to create the link for the page.

      The error and stack trace:

      2014-03-28 13:32:57,211 ERROR freemarker.runtime                                : Template processing error: "Method public java.lang.String info.magnolia.module.commenting.CustomPageCommentNotifModel.retrievePageLink(java.lang.String) threw an exception when invoked on info.magnolia.module.commenting.CustomPageCommentNotifModel@242cd4f8[id=\u003Cnull>,name=model,renderType=\u003Cnull>,description=\u003Cnull>,title=\u003Cnull>,templateScript=\u003Cnull>,autoGeneration=info.magnolia.rendering.template.configured.ConfiguredAutoGeneration@7b51f855[content={},generatorClass=\u003Cnull>]]"
      
      Method public java.lang.String info.magnolia.module.commenting.CustomPageCommentNotifModel.retrievePageLink(java.lang.String) threw an exception when invoked on info.magnolia.module.commenting.CustomPageCommentNotifModel@242cd4f8[id=<null>,name=model,renderType=<null>,description=<null>,title=<null>,templateScript=<null>,autoGeneration=info.magnolia.rendering.template.configured.ConfiguredAutoGeneration@7b51f855[content={},generatorClass=<null>]]
      The problematic instruction:
      ----------
      ==> ${model.retrievePageLink(path)} [on line 2, column 84 in info/magnolia/module/commenting/CustomPageCommentsNotification.ftl]
      ----------
      
      Java backtrace for programmers:
      ----------
      freemarker.template.TemplateModelException: Method public java.lang.String info.magnolia.module.commenting.CustomPageCommentNotifModel.retrievePageLink(java.lang.String) threw an exception when invoked on info.magnolia.module.commenting.CustomPageCommentNotifModel@242cd4f8[id=<null>,name=model,renderType=<null>,description=<null>,title=<null>,templateScript=<null>,autoGeneration=info.magnolia.rendering.template.configured.ConfiguredAutoGeneration@7b51f855[content={},generatorClass=<null>]]
      	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:130)
      	at freemarker.core.MethodCall._getAsTemplateModel(MethodCall.java:93)
      	at freemarker.core.Expression.getAsTemplateModel(Expression.java:89)
      	at freemarker.core.Expression.getStringValue(Expression.java:93)
      	at freemarker.core.DollarVariable.accept(DollarVariable.java:76)
      	at freemarker.core.Environment.visit(Environment.java:221)
      	at freemarker.core.MixedContent.accept(MixedContent.java:92)
      	at freemarker.core.Environment.visit(Environment.java:221)
      	at freemarker.core.IfBlock.accept(IfBlock.java:82)
      	at freemarker.core.Environment.visit(Environment.java:221)
      	at freemarker.core.MixedContent.accept(MixedContent.java:92)
      	at freemarker.core.Environment.visit(Environment.java:221)
      	at freemarker.core.Environment.process(Environment.java:199)
      	at freemarker.template.Template.process(Template.java:237)
      	at info.magnolia.freemarker.FreemarkerHelper.render(FreemarkerHelper.java:153)
      	at info.magnolia.freemarker.FreemarkerHelper.render(FreemarkerHelper.java:135)
      	at info.magnolia.module.mail.templates.impl.FreemarkerEmail.setBodyFromResourceFile(FreemarkerEmail.java:91)
      	at info.magnolia.module.mail.commands.MailCommand.execute(MailCommand.java:96)
      	at info.magnolia.commands.MgnlCommand.executeSynchronized(MgnlCommand.java:81)
      	at info.magnolia.commands.MgnlCommand.execute(MgnlCommand.java:70)
      	at info.magnolia.module.observation.commands.CommandEventListener.onEvent(CommandEventListener.java:119)
      	at info.magnolia.cms.util.ObservationUtil$ObservationBasedDelayedExecutor$1.run(ObservationUtil.java:253)
      	at info.magnolia.cms.util.DelayedExecutor$RunnableWrapper.run(DelayedExecutor.java:103)
      	at EDU.oswego.cs.dl.util.concurrent.ClockDaemon$RunLoop.run(Unknown Source)
      	at java.lang.Thread.run(Thread.java:695)
      Caused by: java.lang.IllegalStateException: Can only get the context path within a WebContext.
      	at info.magnolia.context.MgnlContext.getContextPath(MgnlContext.java:201)
      	at info.magnolia.link.AbsolutePathTransformer.prefixLink(AbsolutePathTransformer.java:97)
      	at info.magnolia.link.AbsolutePathTransformer.transform(AbsolutePathTransformer.java:87)
      	at info.magnolia.link.RelativePathTransformer.transform(RelativePathTransformer.java:89)
      	at info.magnolia.module.commenting.CustomPageCommentNotifModel.retrievePageLink(CustomPageCommentNotifModel.java:55)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      	at java.lang.reflect.Method.invoke(Method.java:597)
      	at freemarker.ext.beans.BeansWrapper.invokeMethod(BeansWrapper.java:866)
      	at freemarker.ext.beans.SimpleMethodModel.exec(SimpleMethodModel.java:106)
      	... 24 more
      2014-03-28 13:33:53,957 ERROR info.magnolia.module.mail.commands.MailCommand    : Could not send email:Can only get the aggregation state within a WebContext.
      

      To reproduce this issue:

      • Install the observation and commenting modules
      • Configure the sendMailOnPageComments as outlined here
      • Note: I encountered this issue MGNLOBS-13
      • Enabled commenting on a page and create a comment
      • Observe the error in the log

        Acceptance criteria

              rkovarik Roman Kovařík
              rgange Richard Gange
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: