cancel
Showing results for 
Search instead for 
Did you mean: 

Error getting a templated email containing @extends to send.

ycmorissette_
Champ in-the-making
Champ in-the-making

Essentially, when I make a base template for emails and I try to extend it using <@extends...>, I get the following error when Nuxeo should send email :

10:56:25,864 ERROR [runtime] 

on line 1, column 1 in modif extends not found.
The problematic instruction:
----------
==> user-directive extends [on line 1, column 1 in modif]
----------

Java backtrace for programmers:
----------
freemarker.core.InvalidReferenceException: on line 1, column 1 in modif extends not found.
	at freemarker.core.UnifiedCall.accept(UnifiedCall.java:134)
	at freemarker.core.Environment.visit(Environment.java:208)
	at freemarker.core.Environment.process(Environment.java:188)
	at freemarker.template.Template.process(Template.java:232)
	at org.nuxeo.ecm.platform.rendering.template.FreemarkerRenderingEngine.process(FreemarkerRenderingEngine.java:62)
	at org.nuxeo.ecm.platform.rendering.impl.RenderingServiceImpl.process(RenderingServiceImpl.java:91)
	at org.nuxeo.ecm.platform.ec.notification.email.EmailHelper.sendmail(EmailHelper.java:150)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.sendNotification(NotificationEventListener.java:303)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.sendNotificationSignalForUser(NotificationEventListener.java:226)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.handleNotifications(NotificationEventListener.java:128)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.handleEvent(NotificationEventListener.java:92)
	at org.nuxeo.ecm.core.event.impl.AsyncEventExecutor$Job.run(AsyncEventExecutor.java:159)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:679)
10:56:25,864 ERROR [NotificationEventListener] An error occurred while trying to send user notification
org.nuxeo.ecm.core.api.ClientException: Failed to send notification email 
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.sendNotification(NotificationEventListener.java:308)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.sendNotificationSignalForUser(NotificationEventListener.java:226)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.handleNotifications(NotificationEventListener.java:128)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.handleEvent(NotificationEventListener.java:92)
	at org.nuxeo.ecm.core.event.impl.AsyncEventExecutor$Job.run(AsyncEventExecutor.java:159)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1110)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:603)
	at java.lang.Thread.run(Thread.java:679)
Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: org.nuxeo.ecm.platform.rendering.RenderingException. message: Freemarker processing failed
	at org.nuxeo.ecm.platform.rendering.template.FreemarkerRenderingEngine.process(FreemarkerRenderingEngine.java:68)
	at org.nuxeo.ecm.platform.rendering.impl.RenderingServiceImpl.process(RenderingServiceImpl.java:91)
	at org.nuxeo.ecm.platform.ec.notification.email.EmailHelper.sendmail(EmailHelper.java:150)
	at org.nuxeo.ecm.platform.ec.notification.NotificationEventListener.sendNotification(NotificationEventListener.java:303)
	... 7 more
Caused by: org.nuxeo.ecm.core.api.WrappedException: Exception: freemarker.core.InvalidReferenceException. message: on line 1, column 1 in modif extends not found.
	at freemarker.core.UnifiedCall.accept(UnifiedCall.java:134)
	at freemarker.core.Environment.visit(Environment.java:208)
	at freemarker.core.Environment.process(Environment.java:188)
	at freemarker.template.Template.process(Template.java:232)
	at org.nuxeo.ecm.platform.rendering.template.FreemarkerRenderingEngine.process(FreemarkerRenderingEngine.java:62)
	... 10 more

I've read that this seems to be that it can't find the file I'm referring to, which is in the same directory.

I then tried to deploy it to nxserver/nuxeo.war/skin/, which also fails with the same error.

Is it really a file location issue?

To me it sounds like a parser error, as if it didn't know what to do with the @extends directive.

3 REPLIES 3

Sun_Seng_David_
Champ on-the-rise
Champ on-the-rise

How does your mail template look like ?

ycmorissette_
Champ in-the-making
Champ in-the-making

baseNotificationTemplate.ftl

Laurent_Doguin
Star Collaborator
Star Collaborator

I guess it's because the <@extends> directive is not available in the ftl rendering engine of the notification service. It will only work in a WebEngine ftl rendering engine.