Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8793891
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T23:10:50+00:00 2026-06-13T23:10:50+00:00

In my grails application in production server I got some issues. In securityFilters I’m

  • 0

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.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T23:10:51+00:00Added an answer on June 13, 2026 at 11:10 pm

    To force the domain objects correct work everywhere, you may want to use lazy property. I don’t have any idea what your object looks like, but if has any kind of object relations, you may force them to be non-lazy. Just like this:

    class Card {
      static hasMany = [cardProperties: CardProperty]
      static mapping = {
        cardProperties lazy: false
      }
    }
    

    To ensure you do have some session available, you may want to create a transactional service. Any service would do, but make sure it doesn’t contain the line

    static transactional = false
    

    If you inject that service to your filters, it will automatically create a transaction and will be able to fetch the lazy properties. But beware! This will begin and finish a transaction. Since you use it in the filter, any page load will have one transaction more.

    Another option is to inject the sessionFactory bean to your filter. Then, you may use pure Hibernate syntax. Just like this one:

    sessionFactory.getCurrentSession().beginTransaction();
    

    It’s not a very good idea, and I would not advise that, but it may work for you. However please note that forwarding the request led to 2 opens of the transaction and 2 closes of the transaction (which is not fine). You’ll have to be VERY CAREFUL when deciding whether to commit the transaction. But if you’re sure you’ll need the database connection on the every page of your app – that may work for you/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is there any way to debug Grails application deployed to production server in Intellij
In my grails application I want to read some values from properties file and
I started a grails application by grails create-app. For modularity, I feel like it
has anybody worked with a Grails application in production in Jetty and Tomcat and
I try to running a grails application in production mode, I see the tutorial
My Grails application has a large number of enums that look like this: public
Every time that I start up my grails application, using the production environment on
I have a Grails 1.3.7 application and am trying to setup log4j for production
I've got a Grails application, using spring-security plugin, deployed on Tomcat and I have
I am developing a grails application, I have domain classes like Tip, TipTag. Concept

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.