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 8171177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T21:22:51+00:00 2026-06-06T21:22:51+00:00

I have this problem regarding my Jasper Report on Grails wherein I should display

  • 0

I have this problem regarding my Jasper Report on Grails wherein I should display the contents of a particular model having this properties

class Schedule {
  Subject subject
  Room room // another class having only a single property [room:String]
  DayOfWeek day //days of the week having only a single property [day:String]
  String timeStart
  String timeEnd
  //constraints
}
class Subject {
   Course course
   String section
   static hasMany = [schedule: Schedule]
   // constraints
}

The problem is that when I try to call the action from the controller where the jasperReport will be getting the Schedule.list(), I get this error in return

URI     /Portal/jasper/index
Class   org.hibernate.LazyInitializationException
Message could not initialize proxy - no Session

Here’s the controller and view code.

// ScheduleController
def report() {
   List scheduleList = Schedule.list()
   chain(controller:'jasper', action:'index', params:params,
         model:[data:scheduleList])
}

//view
<g:jasperReport jasper="schedule_list"
                controller="schedule"
                action="report"
                format="pdf, html"
                name="Schedule List"
                description=" " />

In attempt to resolve this problem, I tried to parse the properties in the domain using this theory below. But in return the report returns all fields on the report null having the correct number of records.

List scheduleList = Schedule.list().collect {
   [cell:
      [it.subject.toString(),
       it.room.toString(),
       it.day.toString(),
       it.timeStart,
       it.timeEnd
      ],id: it.id
   ]    
} as List

Here’s the fields name located in the jasper report [.jrxml]

<field name="subject" class="java.lang.String"/>
<field name="room" class="java.lang.String"/>
<field name="day" class="java.lang.String"/>
<field name="timeStart" class="java.lang.String"/>
<field name="timeEnd" class="java.lang.String"/>

How can I resolve this problem?

  • 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-06T21:22:52+00:00Added an answer on June 6, 2026 at 9:22 pm

    The problem with controller chaining is that the domain objects will no longer be attached to a hibernate session, hence the exception.

    Instead of chaining, use the JasperService (from your controller) to generate the report, as shown here: http://www.grails.org/plugin/jasper

    e.g. something like:

    class ScheduleController {
    
        def jasperService
    
        ...
    
        def report() {
    
            // Get the report data and build the report.
            List scheduleList = Schedule.list()
            JasperReportDef reportDef = jasperService.buildReportDefinition(params, request.getLocale(), [data:sheduleList])
    
            // Non-inline reports (e.g. PDF)
            if (!reportDef.fileFormat.inline && !reportDef.parameters._inline)
            {
                response.setHeader("Content-disposition", "attachment; filename="+(reportDef.parameters._name ?: reportDef.name) + "." + reportDef.fileFormat.extension);
                response.contentType = reportDef.fileFormat.mimeTyp
                response.characterEncoding = "UTF-8"
                response.outputStream << reportDef.contentStream.toByteArray()
            }
            else
            {
                // Inline report (e.g. HTML)
                render(text: reportDef.contentStream, contentType: reportDef.fileFormat.mimeTyp, encoding: reportDef.parameters.encoding ? reportDef.parameters.encoding : 'UTF-8');
            }
    
        ...
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a cross-language problem regarding md5 :). I have this code in Java:
I have read a lot of related topics here regarding this problem but I
I have read the other threads regarding this same problem but I still don't
I am using asp.net mvc 2.0(default binding model) and I have this problem. I
I am having a problem regarding a jquery dropdownmenu. I have put a slidedown
I have a problem regarding this query. I want to get the applicant latest
Most questions regarding this problem are due to missing Xcode; I have Xcode 4.2
I have this logical problem regarding on how to pass value from one JFrame
i have a problem regarding the responseXML of ajax.. I have this code from
I have a problem regarding a query where i want to only display data

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.