weka-3.8 icon indicating copy to clipboard operation
weka-3.8 copied to clipboard

Exception when accessing CSV file.

Open fringefilmsoz opened this issue 3 years ago • 8 comments

Receiving an error when attempting to open a rather large CSV file in either explorer or ARFF viewer. This is causing the conversion to fail.

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: class javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter cannot be cast to class weka.gui.ExtensionFileFilterWithClass (javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter is in module java.desktop of loader 'bootstrap'; weka.gui.ExtensionFileFilterWithClass is in unnamed module of loader 'app')
        weka.gui.ConverterFileChooser.configureCurrentConverter(ConverterFileChooser.java:743)
        weka.gui.ConverterFileChooser.showOpenDialog(ConverterFileChooser.java:553)
        weka.gui.arffviewer.ArffViewerMainPanel.loadFile(ArffViewerMainPanel.java:659)
        weka.gui.arffviewer.ArffViewerMainPanel.actionPerformed(ArffViewerMainPanel.java:1069)
        java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)
        java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
        java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
        java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
        java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
        java.desktop/java.awt.Component.processEvent(Unknown Source)
        java.desktop/java.awt.Container.processEvent(Unknown Source)
        java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        java.base/java.security.AccessController.doPrivileged(Native Method)
        java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        java.desktop/java.awt.EventQueue$5.run(Unknown Source)
        java.desktop/java.awt.EventQueue$5.run(Unknown Source)
        java.base/java.security.AccessController.doPrivileged(Native Method)
        java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

        at weka.gui.ConverterFileChooser.configureCurrentConverter(ConverterFileChooser.java:743)
        at weka.gui.ConverterFileChooser.showOpenDialog(ConverterFileChooser.java:553)
        at weka.gui.arffviewer.ArffViewerMainPanel.loadFile(ArffViewerMainPanel.java:659)
        at weka.gui.arffviewer.ArffViewerMainPanel.actionPerformed(ArffViewerMainPanel.java:1069)
        at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at java.desktop/javax.swing.AbstractButton.doClick(Unknown Source)
        at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
        at java.desktop/javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
        at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
        at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.desktop/java.awt.Component.processEvent(Unknown Source)
        at java.desktop/java.awt.Container.processEvent(Unknown Source)
        at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
        at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
        at java.base/java.security.AccessController.doPrivileged(Native Method)
        at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

fringefilmsoz avatar Jun 24 '21 01:06 fringefilmsoz

What Java version are you using? 16? If so, try using below 16, with 11 recommended.

fracpete avatar Jun 24 '21 01:06 fracpete

I have a suspicion this is an issue with the CSV file. It has a text field which contained a ' as in O'Brien.

fringefilmsoz avatar Jun 24 '21 01:06 fringefilmsoz

You can try the unofficial common-csv-weka-package instead of Weka's own CSVLoader for loading that CSV file.

fracpete avatar Jun 24 '21 02:06 fracpete

@fracpete I've installed. Do i run from simpleCLI like so? image

fringefilmsoz avatar Jun 24 '21 03:06 fringefilmsoz

Personally, I'd use the loader in the Weka Explorer rather than in the SimpleCLI (makes it also easier to tweak options for the loader). The full classname is:

weka.core.converters.CommonCSVLoader <file.csv>

It's possible that you can also use partial classnames (not verified, I don't use the SimpleCLI):

.CommonCSVLoader <file.csv>

fracpete avatar Jun 24 '21 03:06 fracpete

Continue to receive errors on attempting to import a file.

These are very large files.

Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: class javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter cannot be cast to class weka.gui.ExtensionFileFilterWithClass (javax.swing.plaf.basic.BasicFileChooserUI$AcceptAllFileFilter is in module java.desktop of loader 'bootstrap'; weka.gui.ExtensionFileFilterWithClass is in unnamed module of loader 'app') weka.gui.ConverterFileChooser.configureCurrentConverter(ConverterFileChooser.java:743) weka.gui.ConverterFileChooser.showOpenDialog(ConverterFileChooser.java:553) weka.gui.explorer.PreprocessPanel.setInstancesFromFileQ(PreprocessPanel.java:1004) weka.gui.explorer.PreprocessPanel$5.actionPerformed(PreprocessPanel.java:341) java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source) java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source) java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source) java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source) java.desktop/java.awt.Component.processMouseEvent(Unknown Source) java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source) java.desktop/java.awt.Component.processEvent(Unknown Source) java.desktop/java.awt.Container.processEvent(Unknown Source) java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source) java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source) java.desktop/java.awt.Component.dispatchEvent(Unknown Source) java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source) java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source) java.desktop/java.awt.Component.dispatchEvent(Unknown Source) java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source) java.desktop/java.awt.EventQueue$4.run(Unknown Source) java.desktop/java.awt.EventQueue$4.run(Unknown Source) java.base/java.security.AccessController.doPrivileged(Native Method) java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) java.desktop/java.awt.EventQueue$5.run(Unknown Source) java.desktop/java.awt.EventQueue$5.run(Unknown Source) java.base/java.security.AccessController.doPrivileged(Native Method) java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source) java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source) java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

    at weka.gui.ConverterFileChooser.configureCurrentConverter(ConverterFileChooser.java:743)
    at weka.gui.ConverterFileChooser.showOpenDialog(ConverterFileChooser.java:553)
    at weka.gui.explorer.PreprocessPanel.setInstancesFromFileQ(PreprocessPanel.java:1004)
    at weka.gui.explorer.PreprocessPanel$5.actionPerformed(PreprocessPanel.java:341)
    at java.desktop/javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
    at java.desktop/javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
    at java.desktop/javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
    at java.desktop/javax.swing.DefaultButtonModel.setPressed(Unknown Source)
    at java.desktop/javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Source)
    at java.desktop/java.awt.AWTEventMulticaster.mouseReleased(Unknown Source)
    at java.desktop/java.awt.Component.processMouseEvent(Unknown Source)
    at java.desktop/javax.swing.JComponent.processMouseEvent(Unknown Source)
    at java.desktop/java.awt.Component.processEvent(Unknown Source)
    at java.desktop/java.awt.Container.processEvent(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
    at java.desktop/java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.Container.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Window.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.Component.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
    at java.desktop/java.awt.EventQueue$4.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
    at java.desktop/java.awt.EventQueue$5.run(Unknown Source)
    at java.base/java.security.AccessController.doPrivileged(Native Method)
    at java.base/java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
    at java.desktop/java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.desktop/java.awt.EventDispatchThread.run(Unknown Source)

fringefilmsoz avatar Jun 29 '21 04:06 fringefilmsoz

I'm not sure why you are getting the java.lang.ClassCastException. Have you tried using the CSV loader directly from the terminal rather than the GUI? What version of Java are you using? I recommend using 11.

fracpete avatar Jun 29 '21 04:06 fracpete

I'm using the default Java that comes with the install, which the documentation indicates is JDK 11.

I'll try direct csv loading if i can work out the syntax.

fringefilmsoz avatar Jun 29 '21 04:06 fringefilmsoz