Session-scoped service in taglib

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Session-scoped service in taglib

Tom Nichols
Hi --

I'm trying to use a taglib that contains a session-scoped service like so:

class DocumentService {
        static scope = 'session'
        public getPubCodes() {
           //....
        }
}

class DefaultTagLib {
        DocumentService documentService

        def pubSelect = { attrs ->
                out << render( template: 'pubSelect',
                                collection:documentService.getPubCodes() )
        }
}

And I get this happy exception at startup:
Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
ng bean with name 'documentumService': Scope 'session' is not active for the cur
rent thread; consider defining a scoped proxy for this bean if you intend to ref
er to it from a singleton; nested exception is java.lang.IllegalStateException:
No thread-bound request found: Are you referring to request attributes outside o

So.. do I have to manually configure the service bean in resources.xml?

Thanks,
-Tom

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Session-scoped service in taglib

graemer
Please raise an issue

Cheers

On 10/9/07, Tom Nichols <[hidden email]> wrote:

> Hi --
>
> I'm trying to use a taglib that contains a session-scoped service like so:
>
> class DocumentService {
>         static scope = 'session'
>         public getPubCodes() {
>            //....
>         }
> }
>
> class DefaultTagLib {
>         DocumentService documentService
>
>         def pubSelect = { attrs ->
>                 out << render( template: 'pubSelect',
>                                 collection:documentService.getPubCodes() )
>         }
> }
>
> And I get this happy exception at startup:
> Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
> ng bean with name 'documentumService': Scope 'session' is not active for the cur
> rent thread; consider defining a scoped proxy for this bean if you intend to ref
> er to it from a singleton; nested exception is java.lang.IllegalStateException:
> No thread-bound request found: Are you referring to request attributes outside o
>
> So.. do I have to manually configure the service bean in resources.xml?
>
> Thanks,
> -Tom
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>


--
Graeme Rocher
Grails Project Lead
http://grails.org

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email

Reply | Threaded
Open this post in threaded view
|

Re: Session-scoped service in taglib

Tom Nichols
Done.  http://jira.codehaus.org/browse/GRAILS-1697

Sorry I didn't respond sooner -- Gmail was going spam-filter crazy and
filtered a bunch of mailing list emails.

Thanks!


On 10/9/07, Graeme Rocher <[hidden email]> wrote:

> Please raise an issue
>
> Cheers
>
> On 10/9/07, Tom Nichols <[hidden email]> wrote:
> > Hi --
> >
> > I'm trying to use a taglib that contains a session-scoped service like so:
> >
> > class DocumentService {
> >         static scope = 'session'
> >         public getPubCodes() {
> >            //....
> >         }
> > }
> >
> > class DefaultTagLib {
> >         DocumentService documentService
> >
> >         def pubSelect = { attrs ->
> >                 out << render( template: 'pubSelect',
> >                                 collection:documentService.getPubCodes() )
> >         }
> > }
> >
> > And I get this happy exception at startup:
> > Caused by: org.springframework.beans.factory.BeanCreationException: Error creati
> > ng bean with name 'documentumService': Scope 'session' is not active for the cur
> > rent thread; consider defining a scoped proxy for this bean if you intend to ref
> > er to it from a singleton; nested exception is java.lang.IllegalStateException:
> > No thread-bound request found: Are you referring to request attributes outside o
> >
> > So.. do I have to manually configure the service bean in resources.xml?
> >
> > Thanks,
> > -Tom
> >
> > ---------------------------------------------------------------------
> > To unsubscribe from this list please visit:
> >
> >     http://xircles.codehaus.org/manage_email
> >
> >
>
>
> --
> Graeme Rocher
> Grails Project Lead
> http://grails.org
>
> ---------------------------------------------------------------------
> To unsubscribe from this list please visit:
>
>     http://xircles.codehaus.org/manage_email
>
>

---------------------------------------------------------------------
To unsubscribe from this list please visit:

    http://xircles.codehaus.org/manage_email