You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for reporting an issue for Grails framework, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.
Example that reproduces the problem uploaded to Github
Full description of the issue provided (see below)
Full description
We have code that processes GSP templates from a database for emails so they can be edited regularly. When using the GroovyPagesTemplateEngine within ASYNC code a nullpointer is thrown from the method writeTo(). Outside of a promise task everything works fine.
A little more info - I spent some time debugging the grails/groovy code and the issue is that this is not running in the context of a web request (its scheduled) and the GSP template code is looking for the web request context/binding. So this goes back to my question I posed on the Grails slack channel - should one be able to process GSP templates outside of a web request? Perhaps I have to switch to simpler template engine?
jdaugherty
pushed a commit
to jdaugherty/grails-gsp
that referenced
this issue
Jan 15, 2025
Thanks for reporting an issue for Grails framework, please review the task list below before submitting the
issue. Your issue report will be closed if the issue is incomplete and the below tasks not completed.
NOTE: If you are unsure about something and the issue is more of a question a better place to ask questions is on Stack Overflow (http://stackoverflow.com/tags/grails) or Slack (http://slack-signup.grails.org). DO NOT use the issue tracker to ask questions.
Task List
Full description
We have code that processes GSP templates from a database for emails so they can be edited regularly. When using the GroovyPagesTemplateEngine within ASYNC code a nullpointer is thrown from the method writeTo(). Outside of a promise task everything works fine.
There is no stacktrace.
Steps to Reproduce
take mrhaki example from blog
http://mrhaki.blogspot.com/2010/05/grails-goodness-use-gsp-template-engine.html
and execute within futures task
Code to reproduce issue
Example service with test method that displays issue:
class TestService {
def groovyPagesTemplateEngine
void test() {
def p1 = task{
GSP Template Engine
This is just a sample with template text.
<g:if test="${show}">
We can use taglibs in our template!
</g:if>Expected Behaviour
nullpointer not thrown when executed async.
Actual Behaviour
nullpointer is thrown from groovyPagesTemaplteEngine.writeTo() when executed from within promise.
Environment Information
Example Application
I am copying it here as well.
class TestService {
def groovyPagesTemplateEngine
void test() {
def p1 = task{
GSP Template Engine
This is just a sample with template text.
<g:if test="${show}">
We can use taglibs in our template!
</g:if>The text was updated successfully, but these errors were encountered: