jdemetra / jdemetra-app

JDemetra+ v2 desktop application
European Union Public License 1.2
76 stars 30 forks source link

Can't read excel files in JDemetra #791

Closed pablocarvallo closed 2 months ago

pablocarvallo commented 1 year ago

Hi, I've just installed -once again- JDemetra+ v2.2.4. On another computer I can open an Excel spreadsheet without any problem, but on this computer I get this error message when I want to open the spreadsheet sheets: "RuntimeException: java.lang.RuntimeException: Fyle type not supported". I am using files with .xlsx extension, but I have also tried with .xls extensions, without success. The other problem is that when I open the file search window, Excel files do not appear, even though the "Spreadsheet file" option is checked in the "Files of type:" menu. So, I have to set "All files" for the Excel file to appear. I am grateful if you can guide me on how to solve this problem.

error_jdemetra

charphi commented 1 year ago

Which version of Java/Windows are you using ? (see about box) Is the file a valid xlsx file ? Can you open it with Excel on the same computer ?

pablocarvallo commented 1 year ago

Which version of Java/Windows are you using ? (see about box) Is the file a valid xlsx file ? Can you open it with Excel on the same computer ?

Hi Charphi. I'm using Windows 10 and Java 20.0.2.0. My xlsx files are valid, I use them in the same computer, I can use them in Stata, and I work with these spreadsheets in Excel. Thank you very much!

charphi commented 1 year ago

OK, I re-read your first comment. It seems to me that your installation of JD+ v2.2.4 is somehow broken. Some resources (that allow to read Excel files) are missing. There are a few possible causes to that, antivirus being one.

I would suggest to reinstall JD+ and try again. If this doesn't work, try to compare the JD+ install folder on the problematic computer with a working one.

pablocarvallo commented 1 year ago

OK, I re-read your first comment. It seems to me that your installation of JD+ v2.2.4 is somehow broken. Some resources (that allow to read Excel files) are missing. There are a few possible causes to that, antivirus being one.

I would suggest to reinstall JD+ and try again. If this doesn't work, try to compare the JD+ install folder on the problematic computer with a working one.

Hi Charphi, thanks again for your contribution. I've installed the same version of JDemetra+ in other computer and it works fine. I tried with the same excel files, and opens properly. As you suggested to me, I compared the folder and subfolders in both computers and are exactly the same. Very strange...and very frustrating :(

charphi commented 1 year ago

OK; that is strange. Could you try to remove the user directory of JD+ ? (See https://github.com/jdemetra/jdemetra-app/wiki/Quick-install-guide#user-directory) Note that this will remove your JD+ preferences. You can also just move the folder instead of removing it.

niklaag commented 11 months ago

I also have the same issue. I've reinstalled the JDK package and NBDemetra 2.2.4 a couple of times without any change. Java is indeed installed, I've also tried to manually launch NBDemetra with the --javahome jdk-location, etc.

I've used earlier versions of NBDemetra as well, but this new version does not recognize .xls or .xlsx files that I've used successfully earlier. I'm not sure whether this is a problem with 2.2.4 per se, I've also found that NBDemetra is highly sensitive to certain Windows settings.

pablocarvallo commented 11 months ago

I also have the same issue. I've reinstalled the JDK package and NBDemetra 2.2.4 a couple of times without any change. Java is indeed installed, I've also tried to manually launch NBDemetra with the --javahome jdk-location, etc.

I've used earlier versions of NBDemetra as well, but this new version does not recognize .xls or .xlsx files that I've used successfully earlier. I'm not sure whether this is a problem with 2.2.4 per se, I've also found that NBDemetra is highly sensitive to certain Windows settings.

I could not solve this problem. Finally, I uninstalled that version and installed version 3.2. I think it is a bit different, but at least it reads .xlsx files correctly. Link: https://github.com/jdemetra/jdplus-main/releases/tag/v3.2.0

niklaag commented 11 months ago

Thanks for the clarification! I also got JD 3.2.0 to read spreadsheet files.

I also tried going back to NB 2.2.3 which I've used successfully previously, but didn't get it to work now.

charphi commented 11 months ago

This behavior is strange. It seems that some part of JDemetra+ is not loaded at runtime. There are several possibilities:

As previoulsy commented, could you try to remove the user directory of JD+ ? (save it somewhere before) Then restart JD+, check if works or not. If not, go to the JD+ logs and look for errors.

niklaag commented 11 months ago

Okay, I removed the /var/cache/ and made a new attempt.

See the picture for illustration, LHS is NB 2.2.4 and RHS is JD 3.2.0. JD not only identifies the *.xlsx file, but also loads it with default settings successfully.

image

niklaag commented 11 months ago

Edit: Upon further inspection there seems to be a problem with JD as well. I can't initiate new SA multiprocesses without getting the message "undefined specification".

I'm guessing it's got something to do with an overzealous antivirus protection, need to look into this further. The big upside here is that I'm working on my own computer, meaning that there's no fishy corporate policy in place this time.

Here's the messages.log file. messages.log

niklaag commented 11 months ago

The messages.log for the JD run was in another file, here's the error message I'm trying to rectify atm (I'll let you know if I find a solution):

INFO [jdplus.toolkit.desktop.plugin.util.Installer]: ChartPanel buffer enabled SEVERE [org.netbeans.core.modules] java.lang.NullPointerException: spec is marked non-null but is null at jdplus.sa.desktop.plugin.ui.DemetraSaUI.setDefaultSaSpec(DemetraSaUI.java:129) at jdplus.sa.desktop.plugin.ui.DemetraSaUI.setConfig(DemetraSaUI.java:195) at java.base/java.util.Optional.ifPresent(Optional.java:178) at jdplus.sa.desktop.plugin.util.Installer$DemetraSaOptionsStep.restore(Installer.java:64) at jdplus.toolkit.desktop.plugin.util.InstallerStep$AllInstallerStep.restore(InstallerStep.java:165) at jdplus.sa.desktop.plugin.util.Installer.restored(Installer.java:48) at org.netbeans.core.startup.NbInstaller.loadCode(NbInstaller.java:447) [catch] at org.netbeans.core.startup.NbInstaller.loadImpl(NbInstaller.java:370) at org.netbeans.core.startup.NbInstaller.access$000(NbInstaller.java:77) at org.netbeans.core.startup.NbInstaller$1.run(NbInstaller.java:322) at org.openide.filesystems.FileUtil$2.run(FileUtil.java:420) at org.openide.filesystems.EventControl.runAtomicAction(EventControl.java:102) at org.openide.filesystems.FileSystem.runAtomicAction(FileSystem.java:494) at org.openide.filesystems.FileUtil.runAtomicAction(FileUtil.java:404) at org.openide.filesystems.FileUtil.runAtomicAction(FileUtil.java:424) at org.netbeans.core.startup.NbInstaller.load(NbInstaller.java:319) at org.netbeans.ModuleManager.doEnable(ModuleManager.java:1507) at org.netbeans.ModuleManager.enable(ModuleManager.java:1350) at org.netbeans.ModuleManager.enable(ModuleManager.java:1275) at org.netbeans.core.startup.ModuleList.installNew(ModuleList.java:316) at org.netbeans.core.startup.ModuleList.trigger(ModuleList.java:252) at org.netbeans.core.startup.ModuleSystem.restore(ModuleSystem.java:298) at org.netbeans.core.startup.Main.getModuleSystem(Main.java:173) at org.netbeans.core.startup.Main.getModuleSystem(Main.java:142) at org.netbeans.core.startup.Main.start(Main.java:303) at org.netbeans.core.startup.TopThreadGroup.run(TopThreadGroup.java:98) at java.base/java.lang.Thread.run(Thread.java:1583)

charphi commented 11 months ago

The messages.log for the JD run was in another file, here's the error message I'm trying to rectify atm (I'll let you know if I find a solution):

This is a bug in JD+ v3.2.0 that will be fixed in the next release.

Edit: Upon further inspection there seems to be a problem with JD as well. I can't initiate new SA multiprocesses without getting the message "undefined specification".

There is no default specification set during installation. You need to define your own default specification in JD+ settings: see Tool>Options>SA>General>Seasonal Adjustment>Default method

2023-12-05 10_46_41-Options

niklaag commented 11 months ago

Excellent! All is in working condition now, thanks a million.

charphi commented 11 months ago

@pablocarvallo how are you installing JDemetra+ v2.2.4? Are you using jdemetra-2.2.4-setup-windows.exe or jdemetra-2.2.4-bin.zip?

TanguyBarthelemy commented 5 months ago

Hi @charphi, we have also a case at Insee.

image

Someone can't import some .xlsx and .ods files.

charphi commented 5 months ago

@TanguyBarthelemy could you send me the .xlsx file and the JD+ logs (Menu>View>IDE log) by mail ? (if it does not contain confidential data of course)

TanguyBarthelemy commented 5 months ago

Today I suggested he install v3 and fortunately (unfortunately for us), after testing an adjustment in v3, when he uses v2 again, the problem has disappeared. So there are no error logs. So I tested on my side with his data and the import goes well (for the ods, I found the issue jdemetra/jdemetra-app#881 but that's another subject).

djacobsm commented 5 months ago

hi @charphi, I have the following excel file which doesnt really have dates due to it being quarterly data. I have tried to get it to read the data but it won´t. Any recommendations or solutions to this problem? I´m currently using the 3.2.2 Jdemetra+ version, 22.0.1 Java version and windows 11 version. thanks a lot. Captura de pantalla 2024-05-21 220631

charphi commented 5 months ago

@djacobsm This kind of reprensentation is not currently supported by JD+. You need to convert it to a date in order to parse it with JD+.

TanguyBarthelemy commented 5 months ago

If your input data is in this format, you can format it first using R. We have several date conversion functions that reformat the date into a format that can be read by JDemetra+.

If you encounter any further problems or have any questions, please don't hesitate to open a new issue.

charphi commented 5 months ago

@djacobsm I've created a new issue dedicated to your problem at https://github.com/jdemetra/jdplus-main/issues/293 This will be a new feature of v3 and won't be backported to v2.

m20l22 commented 2 months ago

Hello! I had the same problem. I was not able to import Excel files with JDemetra+ v2.2.4 and v2.2.5 using Java 21. I suspect the problem was caused by usage of Java 21. I switched to Java 17 and the problem was gone. I observed the issue and implemented the solution on two different Windows machines. My recommendation would be to use only Java 17 with JDemetra+ v2.2.X to solve this issue.

charphi commented 2 months ago

@m20l22 I've not been able to reproduce the problem. Could you send me a file that triggers the error (without confidential data in it) ?

m20l22 commented 2 months ago

ISI030c1_20240828-104505.xlsx See the file attached. However, I am very sure the problem is not related with the Excel files in question. The problem is observable before the file is opened. The first indication of the problem is that the Open File window does not list spreadsheet files at all. Excel file can be selected only when "All Files" has been selected at the "Files of Type" selector.

charphi commented 2 months ago

You are right. So, could you send me your IDE log (Menu>View>IDE log) after you tried to open an Excel file ?

m20l22 commented 2 months ago

I have sent you my IDE log to your (nbb.be) e-mail.

charphi commented 2 months ago

@m20l22 is right, the problem occurs when JDemetra+ v2.x is used with Java 21 (in fact, almost any Java version > 17). So, the simplest solution is to use Java 17. I will update the documentation accordingly.

For the record, the problem is triggered by some class loading ordering. It is quite difficult to debug and only appends on NetBeans platform.

m20l22 commented 2 months ago

Thank you for testing and confirming the solution.

charphi commented 2 months ago

Fixed in daa70b25facd40ea8b11a2800fd12a0f267b4a5a