Skip to content
This repository has been archived by the owner on Jul 29, 2022. It is now read-only.

java.lang.NoSuchMethodError: com.vaadin.ui.Grid$Column.getValueProvider() issue #30

Open
ScottHuangZL opened this issue Oct 15, 2017 · 8 comments

Comments

@ScottHuangZL
Copy link

ScottHuangZL commented Oct 15, 2017

I am able to run you sample demo smoothly in my local. It look nice, thanks.
But I encounter some issue when I try to leverage it into my own project.

== Add comment at Oct 16 , 2017==
I use Vaadin 8.1.5.
after add below into ExportExcelComponentConfiguration, I find the error change to "getValueProvider()" not find issue.

It can export to excel in case I provide empty data to that grid. So, I am sure it caused by com.vaadin.ui.Grid$Column.getValueProvider()

Other people also report similar issue, so it should be the Vaadin 8.0 & 8.1 grid column.getValueProvider() method change issue.

Can you help to correct it to match latest Vaadin 8.1.X version? Thanks.

private ExportToExcel<Customer> customizeExportExcelUtility(ExportType exportType) { ExportExcelComponentConfiguration<Customer> componentConfig1 = new ExportExcelComponentConfigurationBuilder<Customer>() .withGrid(this.grid) .withVisibleProperties(new String[]{"id","firstName","lastName"}) .withHeaderConfigs(Arrays.asList(new ComponentHeaderConfigurationBuilder().withAutoFilter(true) .withColumnKeys(new String[]{"id_","firstName_","lastName_"}) .build())) .build();

== Original comment at Oct 15 , 2017, at that time is NPE issue==

The "Customer" is my own pojo class.
Dataprovider as below, it is spring JPA for MySQL.
grid.setDataProvider(new ListDataProvider<>(repo.findAll()));

The customizeExportExcelUtility defined as below.
` private ExportToExcel customizeExportExcelUtility(ExportType exportType) {
ExportExcelComponentConfiguration componentConfig1 = new ExportExcelComponentConfigurationBuilder()
.withGrid(this.grid)
.build();
/* Configuring Sheets */
ExportExcelSheetConfiguration sheetConfig1 = new ExportExcelSheetConfigurationBuilder()
.withReportTitle("Grid (Default)")
.withSheetName("Grid (default)")
.withComponentConfigs(Arrays.asList(componentConfig1))
.withIsHeaderSectionRequired(Boolean.TRUE)
.withDateFormat("yyyy-mm-dd")
.build();

    	/* Configuring Excel */
    ExportExcelConfiguration<Customer> config1 = new ExportExcelConfigurationBuilder<Customer>()
            .withGeneratedBy("Scott Huang")
            .withSheetConfigs(Arrays.asList(sheetConfig1))
            .build();

    return new ExportToExcel<>(exportType, config1);
}`

Everything is smooth, grid can show/filter as usual.
However, I encounter NPE issue as below when I try to click to export to excel.
Can you help shed a light on it? Thanks.
`java.lang.NullPointerException: null
at org.vaadin.addons.excelexporter.ExportToExcel.addGridDataRow(ExportToExcel.java:395) [vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.addGridContent(ExportToExcel.java:248) [vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.addGridToExcelSheet(ExportToExcel.java:231) [vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.addGridToExcelSheet(ExportToExcel.java:197) [vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.addComponents(ExportToExcel.java:124) [vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.process(ExportToExcel.java:115) [vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.(ExportToExcel.java:91) [vaadin-excel-exporter-2.0.jar:2.0]
at com.example.demo.view.UIScopedView.customizeExportExcelUtility(UIScopedView.java:155) [classes/:na]
at com.example.demo.view.UIScopedView.lambda$init$61446b05$2(UIScopedView.java:96) [classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]

......

java.lang.NullPointerException: null
at org.vaadin.addons.excelexporter.ExportToExcel.addGridToExcelSheet(ExportToExcel.java:235) ~[vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.addGridToExcelSheet(ExportToExcel.java:197) ~[vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.addComponents(ExportToExcel.java:124) ~[vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.process(ExportToExcel.java:115) ~[vaadin-excel-exporter-2.0.jar:2.0]
at org.vaadin.addons.excelexporter.ExportToExcel.(ExportToExcel.java:91) ~[vaadin-excel-exporter-2.0.jar:2.0]
at com.example.demo.view.UIScopedView.customizeExportExcelUtility(UIScopedView.java:155) ~[classes/:na]
at com.example.demo.view.UIScopedView.lambda$init$61446b05$2(UIScopedView.java:96) ~[classes/:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_121]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_121]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_121]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_121]

`

@ScottHuangZL ScottHuangZL changed the title NPE issue java.lang.NoSuchMethodError: com.vaadin.ui.Grid$Column.getValueProvider() issue Oct 16, 2017
@TheFringe
Copy link

See #29 for solution.

@intr
Copy link

intr commented Jan 26, 2018

The vaadin-compatibility-excel-exporter does not help for me, because I get this exception on Vaadin8 grids (Vaadin version 8.2.1).

@intr
Copy link

intr commented Jan 26, 2018

You can replicate this problem by changing Vaadin version in vaadin-excel-exporter-demo to 8.2.1

@AmulyaJagadeesh
Copy link

@ScottHuangZL Any chances of releasing 2.1 soon? I can see that its been resolved in your github code but its not released yet. I may have to create my own component its no releasing soon.Waiting for your reply.

@realulim
Copy link

I have the same problem using Vaadin 8.3.0. Does anyone know the status of this issue? Is it being worked on or can I fix it myself locally?

@AmulyaJagadeesh
Copy link

I didn't get any updates. I just built a custom component which is suitable for our requirements using poi.

@realulim
Copy link

realulim commented Feb 15, 2018

I forked the repo to https://github.com/realulim/vaadin-excel-exporter and fixed it by updating to Vaadin 8.3.0. At least with my Vaadin app it works now off that fork.

@realulim
Copy link

I deleted my fork again, because now I found https://github.com/jnash67/tableexport-for-vaadin/ which works perfectly fine.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants