Skip to content

Error: Service cannot be cast to builders.dsl.spreadsheet.builder.api.WorkbookDefinition when deployed to tomcat 9 #11

@ddelponte

Description

@ddelponte

I'm exporting data as an excel document. Everything works as expected when run locally, but is failing with the following error message when deployed to tomcat:

java.lang.ClassCastException: my.cool.ExportService cannot be cast to builders.dsl.spreadsheet.builder.api.WorkbookDefinition

        at my.cool.ExportService$__tt__createExcel_closure3.doCall(my.cool.ExportService.groovy:74)

The code with the error looks like:

class ExcelExportService {
    public static final String EXCEL_FILE_SUFIX = ".xlsx"
    public static final String EXCEL_FILE_PREFIX = "stuff"

    def exportExcel(OutputStream outs, List<Stuff> stuffList) {
        File file = File.createTempFile(EXCEL_FILE_PREFIX, EXCEL_FILE_SUFIX)
        PoiSpreadsheetBuilder.create(outs).build {
            apply MyExcelStylesheet
....

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions