Search code examples
grailsgroovynoclassdeffounderror

NoClassDefFoundError after grails package


When I run my Grails project in my local environment everything works fine however when I use grails package and deploy it to our test server it isn't able to load the page because it throws a NoClassDefFoundError

This is the code for the loading of the specific page:

package com.x.scheduledReport

import com.x.Account
import com.x.XUtil
import com.x.ResponseList
import com.x.ScheduledReport
import com.x.UserService
import com.x.scheduledReports.ScheduledReportDeleteAllCommand
import com.x.scheduledReports.ScheduledReportDeleteCommand
import com.x.scheduledReports.ScheduledReportResponse
import com.x.scheduledReports.ScheduledReportUpdateCommand
import com.x.scheduledReports.ScheduledReportsCommand
import grails.transaction.Transactional
import com.x.scheduledreport.ScheduledReportUtil


@Transactional
class ScheduledReportBusinessService {
    ScheduledReportService scheduledReportService
    UserService userService

    def list(Map params) {
        if (params.start) {
            params.offset = params.start
        }
        if (params.length) {
            params.max = Math.min(params.length ? params.length as Integer : 100, 1000)
        }
        params.columns = XUtil.getSearchMap(params)
        Account account = userService.getAccountForCurrentUser()
        def scheduledReports = scheduledReportService.findAllByAccount(params, account)
        params.total = scheduledReports.count
        List<ScheduledReportResponse> scheduledReportResponseList = ScheduledReportUtil.toScheduledReportResponseList(scheduledReports.list)
        new ResponseList(recordsTotal: scheduledReports.count, recordsFiltered: scheduledReports.count,
                data: scheduledReportResponseList, draw: params.draw ? params.draw as int : 0)
    }
}

This is the error thrown in the logs

ERROR 2018-04-05 14:18:42,242 org.springframework.boot.context.web.ErrorPageFilter - Forwarding to error page from request [/rest/scheduledreport/list/true] due to exception [com/x/scheduledreport/ScheduledReportUtil] java.lang.NoClassDefFoundError: com/x/scheduledreport/ScheduledReportUtil at com.x.scheduledReport.ScheduledReportBusinessService.$tt__list(ScheduledReportBusinessService.groovy:33) at com.x.scheduledReport.ScheduledReportBusinessService$_list_closure1.doCall(ScheduledReportBusinessService.groovy)


Solution

  • There were inconsistensies with the folder names for ScheduledReport making all the names the same fixed the issue.