mpetazzoni / ttorrent

BitTorrent Java library with tracker and download client
http://mpetazzoni.github.com/ttorrent/
Apache License 2.0
1.38k stars 502 forks source link

java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory #217

Closed jaydotosh closed 6 years ago

jaydotosh commented 6 years ago

I've been trying to fix the following error for the last week to no avail:

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
    at com.turn.ttorrent.client.Client.<clinit>(Client.java:77)
    at dlMngr.DownloadManager.startDownload(DownloadManager.java:43)
    at dlMngrUI.DownloadManagerUI.btnOpenFromTorFileActionPerformed(DownloadManagerUI.java:138)
    at dlMngrUI.DownloadManagerUI.access$000(DownloadManagerUI.java:18)
    at dlMngrUI.DownloadManagerUI$1.actionPerformed(DownloadManagerUI.java:71)
    at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:2022)
    at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2348)
    at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:402)
    at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:259)
    at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:252)
    at java.awt.Component.processMouseEvent(Component.java:6533)
    at javax.swing.JComponent.processMouseEvent(JComponent.java:3324)
    at java.awt.Component.processEvent(Component.java:6298)
    at java.awt.Container.processEvent(Container.java:2237)
    at java.awt.Component.dispatchEventImpl(Component.java:4889)
    at java.awt.Container.dispatchEventImpl(Container.java:2295)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4889)
    at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4526)
    at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4467)
    at java.awt.Container.dispatchEventImpl(Container.java:2281)
    at java.awt.Window.dispatchEventImpl(Window.java:2746)
    at java.awt.Component.dispatchEvent(Component.java:4711)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
    at java.awt.EventQueue.access$500(EventQueue.java:97)
    at java.awt.EventQueue$3.run(EventQueue.java:709)
    at java.awt.EventQueue$3.run(EventQueue.java:703)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:90)
    at java.awt.EventQueue$4.run(EventQueue.java:731)
    at java.awt.EventQueue$4.run(EventQueue.java:729)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:80)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:201)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
    at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:338)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
    ... 41 more

DownloadManager.java (line marked with PROBLEM CODE:

public void startDownload(Download dl) {
        if(dl.getFileType() == 0) { // If URL

            this.downloadCS = new DownloadCS(dl);

            this.currentDownloads.add(this.downloadCS); // Add to list of current downloads.

            this.downloadCS.start();

        } else if (dl.getFileType() == 1) { // If torrent file

            this.downloadP2P = new DownloadP2P(dl);

            try {
                Client cl;
                cl = new Client( <---------------- ****PROBLEM CODE****
                        // Interface the client will listen on. May cause issues due to 'getLocalHost()'.
                        InetAddress.getLocalHost(),

                        // Load the torrent from the torrent file and use the given
                        // output directory. Partials downloads are automatically recovered.
                        // NOTE: two files passed - needed by class implementation in library (TTorrent).
                        SharedTorrent.fromFile(this.downloadP2P.getFile(), this.downloadP2P.getFileDir()));

OpenSuSE Tumbleweed with:

I have ttorrent added to my netbeans library, as well as slf4j; this is how they've been set up:

ttorrent

classpath: /home/enceladus/Documents/FYP/Download Manager/downloadManager/lib/ttorrent-master/core/target/ttorrent-core-1.6-SNAPSHOT.jar

sources: /home/enceladus/Documents/FYP/Download Manager/downloadManager/lib/ttorrent-master/core/target/ttorrent-core-1.6-SNAPSHOT.jar

javadoc: /home/enceladus/Documents/FYP/Download Manager/downloadManager/lib/ttorrent-master/core/target/ttorrent-core-1.6-SNAPSHOT-javadoc.jar

slf4j

classpath: /home/enceladus/Documents/FYP/Download Manager/downloadManager/lib/slf4j-1.8.0-beta2/log4j-over-slf4j-1.8.0-beta2.jar

sources: /home/enceladus/Documents/FYP/Download Manager/downloadManager/lib/slf4j-1.8.0-beta2/log4j-over-slf4j-1.8.0-beta2-sources.jar

javadoc: N/A

Project screenshot: Project directory

I've tried:

Thanks