关于SLF4J

我对Java应用程序还很陌生。我正在尝试在eclipse中运行此开源应用程序。我已经一一列出了所有需要的外部库,并删除了所有错误。现在,当我运行应用程序时,我在运行时遇到异常。控制台中的消息如下:

Exception in thread "JavaFX Application Thread" Exception in thread "main" java.lang.NoClassDefFoundError: ch/qos/logback/core/joran/spi/JoranException
    at org.slf4j.LoggerFactory.getSingleton(LoggerFactory.java:189)
    at org.slf4j.LoggerFactory.bind(LoggerFactory.java:112)
    at org.slf4j.LoggerFactory.performInitialization(LoggerFactory.java:105)
    at org.slf4j.LoggerFactory.getILoggerFactory(LoggerFactory.java:235)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:208)
    at org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:221)
    at com.shootoff.Main.<clinit>(Main.java:59)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at com.sun.javafx.application.LauncherImpl.lambda$launchApplicationWithArgs$2(LauncherImpl.java:352)
    at com.sun.javafx.application.PlatformImpl.lambda$runAndWait$7(PlatformImpl.java:326)
    at com.sun.javafx.application.PlatformImpl.lambda$null$5(PlatformImpl.java:295)
    at java.security.accessController.doPrivileged(Native Method)
    at com.sun.javafx.application.PlatformImpl.lambda$runLater$6(PlatformImpl.java:294)
    at com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:95)
    at com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
    at com.sun.glass.ui.win.WinApplication.lambda$null$4(WinApplication.java:186)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassnotFoundException: ch.qos.logback.core.joran.spi.JoranException
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 18 more
java.lang.reflect.invocationTargetException
    at sun.reflect.NativeMethodaccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodaccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodaccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at sun.launcher.LauncherHelper$FXHelper.main(Unknown Source)
Caused by: java.lang.NullPointerException
    at com.sun.javafx.application.LauncherImpl.launchApplicationWithArgs(LauncherImpl.java:383)
    at com.sun.javafx.application.LauncherImpl.launchApplication(LauncherImpl.java:328)
    ... 5 more

现在,从我可以看出的异常是关于slf4j日志库。我试图在“配置构建路径”的外部jar部分中包含不同版本的slf4j,但是我遇到了相同的异常。因此,我认为slf4j的版本不是这里的问题。另外在例外中,我可以看到以下行中发生了例外:

  

私有静态最终Logger logger = LoggerFactory.getLogger(Main.class);

除此之外,我对下一步的工作一无所知。

我在下面粘贴了相关代码。希望它有助于解决问题。 谢谢。

package com.shootoff;
import com.shootoff.camera.CameraFactory;
import com.shootoff.camera.cameratypes.OptiTrackCamera;
import com.shootoff.camera.cameratypes.PS3EyeCamera;
import com.shootoff.config.Configuration;
import com.shootoff.config.ConfigurationException;
import com.shootoff.gui.controller.ShootOFFController;
import com.shootoff.headless.HeadlessController;
import com.shootoff.plugins.TextToSpeech;
import com.shootoff.util.HardwareData;
import com.shootoff.util.SystemInfo;
import com.sun.javafx.application.LauncherImpl;
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.net.HttpURLConnection;
import java.net.URL;
import java.net.UnknownHostException;
import java.nio.file.Files;
import java.util.Enumeration;
import java.util.Optional;
import java.util.Properties;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
import java.util.logging.Level;
import javafx.application.Application;
import javafx.application.Platform;
import javafx.concurrent.Task;
import javafx.event.EventHandler;
import javafx.fxml.FXMLLoader;
import javafx.geometry.Pos;
import javafx.scene.Node;
import javafx.scene.Parent;
import javafx.scene.Scene;
import javafx.scene.control.Alert;
import javafx.scene.control.CheckBox;
import javafx.scene.control.Label;
import javafx.scene.control.ProgressBar;
import javafx.scene.control.ProgressIndicator;
import javafx.scene.control.Alert.AlertType;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.FlowPane;
import javafx.scene.layout.HBox;
import javafx.scene.paint.Color;
import javafx.stage.Modality;
import javafx.stage.Stage;
import nu.pattern.OpenCV;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

public class Main extends Application {
    private static final Logger logger = LoggerFactory.getLogger(Main.class);
    private static final int MINIMUM_CPU_SCORE_EXCELLENT = 4000;
    private static final int MINIMUM_CPU_SCORE_PASSABLE = 3000;
    private static final long MINIMUM_RAM_EXCELLENT = 11712L;
    private static final long MINIMUM_RAM_PASSABLE = 4096L;
    private static final String POOR_HARDWARE_MESSAGE = "Hardware Status: Poor -- Based on the data we gathered,\nmATS will likely not run well on this machine.";
    private static final String PASSABLE_HARDWARE_MESSAGE = "Hardware Status: Passable -- Based on the data we gathered,\nmATS will likely run OK on this machine but may miss\noccasional shots.";
    private static final String EXCELLENT_HARDWARE_MESSAGE = "Hardware Status: Excellent -- Based on the data we gathered,\nthis machine should have no problems running MATS.";
    public static final String SHOOTOFF_DOMAIN = "http://shootoffapp.com/";
    private boolean isJWS = false;
    private static final String RESOURCES_MetaDATA_NAME = "shootoff-writable-resources.xml";
    private static final String RESOURCES_JAR_NAME = "shootoff-writable-resources.jar";
    private File resourcesMetadataFile;
    private File resourcesJARFile;
    private Stage primaryStage;
    private static final String VERSION_MetaDATA_NAME = "shootoff-version.xml";
    private static Optional<String> version = Optional.empty();
    private static boolean shouldShowV4lWarning = false;
    public static final String SPLASH_IMAGE = "http://fxexperience.com/wp-content/uploads/2010/06/logo.png";
    private static final int SPLASH_WIDTH = 676;
    private static final int SPLASH_HEIGHT = 227;
lijipeng123 回答:关于SLF4J

SLF4J似乎不是这里的问题。您缺少的是一个logback jar。 在http://logback.qos.ch/处阅读文档,以了解您需要哪个库。

本文链接:https://www.f2er.com/3111260.html

大家都在问