java.lang.NoSuchMethodError what could be the problem

The program that reads mp3 tags and writes to ListView does not work how to fix this error(at least because of what it occurs)?

import javafx.application.Application;
import javafx.collections.FXCollections;
import javafx.collections.ObservableList;
import javafx.fxml.FXMLLoader;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.ListView;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.VBox;
import javafx.stage.Stage;
import org.apache.commons.io.FileUtils;
import org.apache.tika.exception.TikaException;
import org.apache.tika.metadata.Metadata;
import org.apache.tika.parser.ParseContext;
import org.apache.tika.parser.Parser;
import org.apache.tika.parser.mp3.Mp3Parser;
import org.xml.sax.ContentHandler;
import org.xml.sax.helpers.DefaultHandler;
import org.xml.sax.SAXException;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Iterator;
import java.util.List;

public class Main extends Application {

    private Button button;
    @Override
    public void start(Stage primaryStage) throws Exception {

        String fileLocation = "D:\\music";
        File dir = new File(fileLocation);
        button = new Button("Check");
        button.setOnAction( e-> readFiles(dir));
        VBox box = new VBox(button);
        primaryStage.setScene(new Scene(box,300,300));
        primaryStage.show();
    }


    public static void main(String[] args) {
        launch(args);
    }

    public static void readFiles(File baseDirectory) {

        List<Mp3data> mp3data = new ArrayList<Mp3data>();
        ObservableList<Mp3data> langs = FXCollections.observableArrayList(mp3data);
        ListView<Mp3data> langsListView = new ListView<Mp3data>(langs);

        try {

            Iterator<File> iterator = FileUtils.iterateFiles(baseDirectory, new String[]{"mp3"}, true);
            while (iterator.hasNext()) {

                File fileloop = iterator.next();

                InputStream input = new FileInputStream(fileloop);
                ContentHandler handler = new DefaultHandler();
                Metadata metadata = new Metadata();
                Parser parser = new Mp3Parser();
                ParseContext parseCtx = new ParseContext();
                parser.parse(input, handler, metadata, parseCtx);

                input.close();

                String[] metadataNames = metadata.names();

                Mp3data track = new Mp3data();
                track.setArtist(metadata.get("xmpDM:artist"));
                track.setAlbum(metadata.get("xmpDM:album"));
                track.setTitle(metadata.get("title"));
                track.setDuration(toMinutes(metadata.get("xmpDM:duration")));
                track.setPath(fileloop.getAbsolutePath());

                mp3data.add(track);
                langs.add(track);

            }
            FlowPane root = new FlowPane(langsListView);
            Collections.sort(mp3data);
            Scene scene = new Scene(root,600,600);
            Stage window = new Stage();
            window.setTitle("first");
            window.setScene(scene);
            window.show();
//

        } catch (IOException | SAXException | TikaException e) {
            e.printStackTrace();
        }


//        String artist = null;
//        String album = null;
//        for (Mp3data data : mp3data)
//            if (!data.getArtist().equals(artist))
//
//
//
//                if (!data.getAlbum().equals(album))


    }

Mistake:

Exception in thread "JavaFX Application Thread" java.lang.NoSuchMethodError: org.apache.poi.util.IOUtils.skipFully(Ljava/io/InputStream;J)J
    at org.apache.tika.parser.mp3.MpegStream.skipFrame(MpegStream.java:164)
    at org.apache.tika.parser.mp3.Mp3Parser.getAllTagHandlers(Mp3Parser.java:212)
    at org.apache.tika.parser.mp3.Mp3Parser.parse(Mp3Parser.java:70)
    at sample.Main.readFiles(Main.java:75)
    at sample.Main.lambda$start$0(Main.java:43)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:86)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:49)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Node.fireEvent(Node.java:8411)
    at javafx.scene.control.Button.fire(Button.java:185)
    at com.sun.javafx.scene.control.behavior.ButtonBehavior.mouseReleased(ButtonBehavior.java:182)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:96)
    at com.sun.javafx.scene.control.skin.BehaviorSkinBase$1.handle(BehaviorSkinBase.java:89)
    at com.sun.javafx.event.CompositeEventHandler$NormalEventHandlerRecord.handleBubblingEvent(CompositeEventHandler.java:218)
    at com.sun.javafx.event.CompositeEventHandler.dispatchBubblingEvent(CompositeEventHandler.java:80)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:238)
    at com.sun.javafx.event.EventHandlerManager.dispatchBubblingEvent(EventHandlerManager.java:191)
    at com.sun.javafx.event.CompositeEventDispatcher.dispatchBubblingEvent(CompositeEventDispatcher.java:59)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:58)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.BasicEventDispatcher.dispatchEvent(BasicEventDispatcher.java:56)
    at com.sun.javafx.event.EventDispatchChainImpl.dispatchEvent(EventDispatchChainImpl.java:114)
    at com.sun.javafx.event.EventUtil.fireEventImpl(EventUtil.java:74)
    at com.sun.javafx.event.EventUtil.fireEvent(EventUtil.java:54)
    at javafx.event.Event.fireEvent(Event.java:198)
    at javafx.scene.Scene$MouseHandler.process(Scene.java:3757)
    at javafx.scene.Scene$MouseHandler.access$1500(Scene.java:3485)
    at javafx.scene.Scene.impl_processMouseEvent(Scene.java:1762)
    at javafx.scene.Scene$ScenePeerListener.mouseEvent(Scene.java:2494)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:394)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler$MouseEventNotification.run(GlassViewEventHandler.java:295)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.lambda$handleMouseEvent$353(GlassViewEventHandler.java:432)
    at com.sun.javafx.tk.quantum.QuantumToolkit.runWithoutRenderLock(QuantumToolkit.java:389)
    at com.sun.javafx.tk.quantum.GlassViewEventHandler.handleMouseEvent(GlassViewEventHandler.java:431)
    at com.sun.glass.ui.View.handleMouseEvent(View.java:555)
    at com.sun.glass.ui.View.notifyMouse(View.java:937)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$147(WinApplication.java:177)
    at java.lang.Thread.run(Thread.java:748)
Author: Farkhod Daniyarov, 2019-04-22

1 answers

You most likely have a so-called jarhell. This is a confusion with library dependencies. Most often, this error occurs when the same libraries with different versions fall into the application's classpath at runtime. Or a group of libraries that should be of the same version, but for some reason the versions do not match. In such cases, it usually helps to find the class that the program is swearing at throughout the project (including dependencies) and analyze the libraries (jars) in which this class is used. the class appears. We also carefully read pom. xml/build.gradle/where-do-you-have-there-described-dependencies for library versions.

 0
Author: zolt, 2019-04-23 02:16:37