Exception in thread "main" java.lang.NoClassDefFoundError: org / apache / logging / lo g4j / LogManager

-1

I'm trying to start a jar file and as soon as I run it, I get this error! Can you help me?

C:\Unky\Web\BloodStrikeServer-master>mvn clean package -Dmaven.test.skip=true
'mvn' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.

C:\Unky\Web\BloodStrikeServer-master>java -jar target/lobbyplayer-0.0.1-SNAPSHOT
-fat.jar
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/logging/lo
g4j/LogManager
        at com.bloodstrike.lobbyserver.Main.<clinit>(Main.java:17)
Caused by: java.lang.ClassNotFoundException: org.apache.logging.log4j.LogManager

        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 1 more

C:\Unky\Web\BloodStrikeServer-master>pause Pressione qualquer tecla para continuar. . .

Main file:

package com.bloodstrike.lobbyserver;


import java.io.FileOutputStream;

import io.vertx.core.logging.Logger;
import io.vertx.core.logging.LoggerFactory;

import com.bloodstrike.lobbyserver.manager.NetworkManager;

import io.vertx.core.Vertx;
import io.vertx.core.net.NetClient;
import io.vertx.core.net.NetServer;
import io.vertx.core.net.NetSocket;

public class Main {
    private static final Logger logger = LoggerFactory.getLogger(Main.class);

    public static void main(String[] args) throws Throwable {
        logger.info("===============================================================================");
        logger.info("BloodStrike Lobby Server");
        logger.info("Créditos: ExtremsX");
        logger.info("Versão: 0.1 Beta");
        logger.info("===============================================================================");

        logger.info("Carregando Configurações");
        Config.loadConfig();

        logger.info("Iniciando NetworkManager");
        NetworkManager.getInstance();

            Vertx.vertx().setTimer(1000, id -> {
                    try {
                        startClientDebug();
                        logger.info("Iniciando DUMPER");
                    } catch (Exception e) {
                        logger.error("Falha ao iniciar o DUMPER");
                    }
            });


        logger.info("Iniciando NetworkServer");
        NetworkServer.getInstance();
    }

    private static void startClientDebug() throws Exception {
        Logger log = LoggerFactory.getLogger(Main.class);
        int port = Integer.parseInt("4000");
        String host = "0.0.0.0";
        FileOutputStream fos = new FileOutputStream("./network.dump");

        NetServer server = Vertx.vertx().createNetServer();
        server.connectHandler(handler -> {
            NetClient client = Vertx.vertx().createNetClient();
            log.error("Nova conexão recebida de " + handler.remoteAddress());

            client.connect(port, host, res -> {
                if (!res.succeeded()) {
                    log.error("Erro ao se conectar ao servidor", res.cause());
                    try { fos.close(); } catch (Exception e) { }
                    return;
                }
                log.error("Erro ao se conectar ao servidor", res.cause());

                NetSocket socket = res.result();
                // Do cliente para o servidor
                handler.handler(buffer -> {
                    try { 
                        fos.write("\n\nClient -> Servidor\n".getBytes()); 
                        fos.write(buffer.getBytes());
                    } catch (Exception e) { }
                    socket.write(buffer);
                });

                // Do servidor para o cliente
                socket.handler(buffer -> {
                    try { 
                        fos.write("\n\nServidor -> Client\n".getBytes());
                        fos.write(buffer.getBytes());
                    } catch (Exception e) { }
                    handler.write(buffer);
                });
            });
        });
        server.listen(3999, res -> {
            if (!res.succeeded())
                return;
            log.info("Servidor DUMPER iniciado na porta 3999");
        });
    }
}
    
asked by anonymous 29.07.2018 / 23:36

1 answer

0
C:\Unky\Web\BloodStrikeServer-master>mvn clean package -Dmaven.test.skip=true
'mvn' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.

Maven is not properly installed. Just enter the maven and make sure the bin folder is in the %PATH% variable.

Regarding this command:

java -jar target/lobbyplayer-0.0.1-SNAPSHOT-fat.jar

Failed to put log4j in classpath. It should look like this:

java -cp log4j.jar -jar target/lobbyplayer-0.0.1-SNAPSHOT-fat.jar

You may also need to put several other JARs, it would look like this:

java -cp pasta1/jar1.jar;pasta2/jar2.jar -jar target/lobbyplayer-0.0.1-SNAPSHOT-fat.jar

Use ; to separate the name of a JAR from the other in the classpath. You may end up needing a lot of JARs.

    
30.07.2018 / 00:00