AnsweredAssumed Answered

root objects in email template not available

Question asked by nikes on Jul 8, 2011
Latest reply on Jul 8, 2011 by mrogers
Hi all,

I am trying to utilize "url" root object in freemarker template for email, but getting following error

Expression url is undefined on line 8, column 13 in workspace://SpacesStore/8da5d9eb-06af-4637-8bb3-ff2b35245458.
The problematic instruction:
———-
==> ${url.context} [on line 8, column 11 in workspace://SpacesStore/8da5d9eb-06af-4637-8bb3-ff2b35245458]
———-

Java backtrace for programmers:
———-
freemarker.core.InvalidReferenceException: Expression url is undefined on line 8, column 13 in workspace://SpacesStore/8da5d9eb-06af-4637-8bb3-ff2b35245458.
   at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
   at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
   at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
   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:208)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
   at freemarker.core.Environment.visit(Environment.java:415)
   at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.Environment.process(Environment.java:188)
   at freemarker.template.Template.process(Template.java:237)
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:202)
   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:181)
   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:200)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob.sendNotification(DocumentExpiryNotificationJob.java:301)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob.execJob(DocumentExpiryNotificationJob.java:210)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob$1.execute(DocumentExpiryNotificationJob.java:85)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:234)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob.execute(DocumentExpiryNotificationJob.java:91)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
15:05:00,159 ERROR [org.quartz.core.JobRunShell] Job DEFAULT.ToBeExpiredDocumentJobDetail threw an unhandled Exception:
org.alfresco.service.cmr.repository.TemplateException: 06080013 Error during processing of the template 'Expression url is undefined on line 8, column 13 in workspace://SpacesStore/8da5d9eb-06af-4637-8bb3-ff2b35245458.'. Please contact your system administrator.
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:206)
   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:181)
   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:200)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob.sendNotification(DocumentExpiryNotificationJob.java:301)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob.execJob(DocumentExpiryNotificationJob.java:210)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob$1.execute(DocumentExpiryNotificationJob.java:85)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:234)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob.execute(DocumentExpiryNotificationJob.java:91)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
Caused by: freemarker.core.InvalidReferenceException: Expression url is undefined on line 8, column 13 in workspace://SpacesStore/8da5d9eb-06af-4637-8bb3-ff2b35245458.
   at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
   at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
   at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
   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:208)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
   at freemarker.core.Environment.visit(Environment.java:415)
   at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.Environment.process(Environment.java:188)
   at freemarker.template.Template.process(Template.java:237)
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:202)
   … 10 more
15:05:00,159 ERROR [org.quartz.core.ErrorLogger] Job (DEFAULT.ToBeExpiredDocumentJobDetail threw an exception.
org.quartz.SchedulerException: Job threw an unhandled exception. [See nested exception: org.alfresco.service.cmr.repository.TemplateException: 06080013 Error during processing of the template 'Expression url is undefined on line 8, column 13 in workspace://SpacesStore/8da5d9eb-06af-4637-8bb3-ff2b35245458.'. Please contact your system administrator.]
   at org.quartz.core.JobRunShell.run(JobRunShell.java:213)
   at org.quartz.simpl.SimpleThreadPool$WorkerThread.run(SimpleThreadPool.java:529)
Caused by: org.alfresco.service.cmr.repository.TemplateException: 06080013 Error during processing of the template 'Expression url is undefined on line 8, column 13 in workspace://SpacesStore/8da5d9eb-06af-4637-8bb3-ff2b35245458.'. Please contact your system administrator.
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:206)
   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:181)
   at org.alfresco.repo.processor.TemplateServiceImpl.processTemplate(TemplateServiceImpl.java:200)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob.sendNotification(DocumentExpiryNotificationJob.java:301)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob.execJob(DocumentExpiryNotificationJob.java:210)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob$1.execute(DocumentExpiryNotificationJob.java:85)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:327)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:234)
   at com.saintgobain.packaging.actions.DocumentExpiryNotificationJob.execute(DocumentExpiryNotificationJob.java:91)
   at org.quartz.core.JobRunShell.run(JobRunShell.java:202)
   … 1 more
Caused by: freemarker.core.InvalidReferenceException: Expression url is undefined on line 8, column 13 in workspace://SpacesStore/8da5d9eb-06af-4637-8bb3-ff2b35245458.
   at freemarker.core.TemplateObject.assertNonNull(TemplateObject.java:124)
   at freemarker.core.TemplateObject.invalidTypeException(TemplateObject.java:134)
   at freemarker.core.Dot._getAsTemplateModel(Dot.java:78)
   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:208)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.IteratorBlock$Context.runLoop(IteratorBlock.java:179)
   at freemarker.core.Environment.visit(Environment.java:415)
   at freemarker.core.IteratorBlock.accept(IteratorBlock.java:102)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.MixedContent.accept(MixedContent.java:92)
   at freemarker.core.Environment.visit(Environment.java:208)
   at freemarker.core.Environment.process(Environment.java:188)
   at freemarker.template.Template.process(Template.java:237)
   at org.alfresco.repo.template.FreeMarkerProcessor.process(FreeMarkerProcessor.java:202)
   … 10 more

Which alfresco root  objects  are available in independent freemarker template (means not related to webscript)?

Requirement is to construct document download path which requires full path containing server path to be prefixed followed by document url.

Thanks,
Nikesh

Outcomes