-1
I am trying to start a jar file and as soon as I run, I get this error! You can 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 archive:
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");
});
}
}
If in your file
main
, you put a//
before any call, use or import ofLogger
, it works?– Victor Stafusa
Have you tried switching calls to log4j for
System.out.println
?– Victor Stafusa