In my grails application in production server I got some issues. In securityFilters I'm injecting springSecurityService and at some point I'm asking something like
if(springSecurityService?.currentUser?.client){
...
}
But system throws an error as
Error 500: Internal Server Error
Class
org.hibernate.LazyInitializationException
Message
could not initialize proxy - no Session
Trace
Line | Method
->> 32 | doCall in SecurityFilters$_closure1_closure2_closure4
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
| 82 | doFilterInternal in com.linkedin.grails.profiler.ProfilerFilter
| 190 | invoke . . . . . in org.apache.jk.server.JkCoyoteHandler
| 291 | invoke in org.apache.jk.common.HandlerRequest
| 776 | invoke . . . . . in org.apache.jk.common.ChannelSocket
| 705 | processConnection in ''
| 898 | runIt . . . . . . in org.apache.jk.common.ChannelSocket$SocketConnection
^ 636 | run in java.lang.Thread
line 32 is the place where I call if statement mentioned above. Do you have any clue how to solve this LazyInitializationException? What I am doing wrong?
Note : "client" is the domain class which this user belongs to but it is not mentioned in belongsTo parameter of Person
Thanks.