Can't configure a Java server.

Started by NicusorN5, Aug 22, 2018, 12:01 PM

Previous topic - Next topic

NicusorN5

javaplugin.proporties
jvmLibPath=C:\Program Files\Java\jre1.8.0_151\bin\server\jvm.dll
mainEventsClass=com.rcnr.events.MainController
classPath="C:\Users\NicusorN5\Desktop\Romania Cops N Robbers Remastered\RCNRRemastered\dist\"
maxMemory=50m

The log containing the error:
1534939103872:  INFO - (VcmpPluginInit) VC:MP Java integration plugin loading...
1534939103878:  INFO - (JavaCore::LoadLibraryFunctions) Java VM library loaded.
1534939103878:  INFO - (JavaCore::LoadLibraryFunctions) Java VM library functions loaded.
1534939103878:  INFO - (JavaCore::SetupJVMArguments) Java VM settings initialized.
1534939104045:  INFO - (JavaCore::CreateJVM) Java VM created.
1534939104045:  INFO - (JavaCore::AttachThreadToJVM) Server thread attached to VM.
1534939104057: ERROR - (JavaExceptionHandler::Initialise) Exception in Java code
java.lang.NoClassDefFoundError: com/maxorator/vcmp/java/plugin/exceptions/DeadEntityException
Caused by: java.lang.ClassNotFoundException: com.maxorator.vcmp.java.plugin.exceptions.DeadEntityException
    java.net.URLClassLoader.findClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
    sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
1534939104057: ERROR - (JavaExceptionHandler::Initialise) Exception classes not found (ThreadSafetyException, DeadEntityException, NullPointerException).
1534939104057: ERROR - (JavaCore::Initialise) Setting up exception handler failed.
1534939104057: ERROR - (JavaEventProxy::StartVM) JavaCore initialisation failed.

Everthing in the java.proporties file seems correct to me, but I dunno why this still happends.

:edit: UPDATE1: NewK's java server works correctly, so there's might be something wrong with my code.

:edit: UPDATE2: My Java project code is exactly the same as NewK's but only the classes names are changed.


NicusorN5

DESPERATE BUMP
com.rcnr.events.MainController class
[noae]/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rcnr.events;
import com.maxorator.vcmp.java.plugin.integration.RootEventHandler;
import com.maxorator.vcmp.java.plugin.integration.placeable.CheckPoint;
import com.maxorator.vcmp.java.plugin.integration.placeable.GameObject;
import com.maxorator.vcmp.java.plugin.integration.placeable.Pickup;
import com.maxorator.vcmp.java.plugin.integration.player.Player;
import com.maxorator.vcmp.java.plugin.integration.server.Server;
import com.maxorator.vcmp.java.plugin.integration.vehicle.Vehicle;
import com.maxorator.vcmp.java.tools.commands.CommandRegistry;
import com.maxorator.vcmp.java.tools.timers.TimerRegistry;
/**
 *
 * @author NicusorN5
 */

public class MainController extends RootEventHandler {

    public static final int COLOUR_YELLOWISH = 0xFFFF5500;

    private ClientDataController onClientData;
    protected CommandRegistry commandRegistry;
    protected TimerRegistry timerRegistry;
    public static Server server;

    public MainController(Server server) {
        super(server);
        this.server = server;
        this.timerRegistry = new TimerRegistry();
        this.onClientData = new ClientDataController();
        this.commandRegistry = new CommandRegistry(server);

       //this.commandRegistry.addController(new PlayerCommands());
       //this.commandRegistry.addController(new AdminCommands());

    }

    @Override
    public void onServerLoadScripts() {

    }
   
   

    public void onPlayerWeaponChange(Player p, int oldWep, int newWep) {

    }

    public void onPlayerMove(Player player, float lastX, float lastY, float lastZ, float newX, float newY, float newZ) {

    }

    public void onPlayerHealthChange(Player player, float lastHP, float newHP) {

    }

    public void onPlayerArmourChange(Player player, float lastArmour, float newArmour) {

    }

    @Override
    public void onPlayerConnect(Player player) {
        server.sendClientMessage(player, COLOUR_YELLOWISH, "Welcome to the server " + player.getName() + "!");
    }

    @Override
    public void onPlayerModuleList(Player player, String list) {

    }

    @Override
    public boolean onServerInitialise() {

        return true;
    }

    @Override
    public void onServerUnloadScripts() {

    }

    @Override
    public void onServerFrame() {
        timerRegistry.process();
    }

    @Override
    public String onIncomingConnection(String name, String password, String ip) {
        return name;
    }

    @Override
    public void onPlayerSpawn(Player player) {

    }

    @Override
    public void onPlayerDisconnect(Player player, int reason) {

    }

    @Override
    public void onPlayerEnterVehicle(Player player, Vehicle vehicle, int slot) {

    }

    @Override
    public void onPlayerExitVehicle(Player player, Vehicle vehicle) {

    }

    @Override
    public void onVehicleExplode(Vehicle vehicle) {

    }

    @Override
    public boolean onPlayerCommand(Player player, String message) {
        return commandRegistry.processCommand(player, message);
    }

    @Override
    public void onPlayerCrashReport(Player player, String crashLog) {

    }

    @Override
    public void onCheckPointExited(CheckPoint checkPoint, Player player) {

    }

    @Override
    public void onCheckPointEntered(CheckPoint checkPoint, Player player) {

    }

    @Override
    public void onPickupRespawn(Pickup pickup) {

    }

    @Override
    public void onPickupPicked(Pickup pickup, Player player) {

    }

    @Override
    public boolean onPickupPickAttempt(Pickup pickup, Player player) {

        return true;
    }

    @Override
    public void onObjectTouched(GameObject object, Player player) {

    }

    @Override
    public void onObjectShot(GameObject object, Player player, int weaponId) {

    }

    @Override
    public void onVehicleRespawn(Vehicle vehicle) {

    }

    @Override
    public void onVehicleUpdate(Vehicle vehicle, int updateType) {

    }

    @Override
    public void onPlayerSpectate(Player player, Player spectated) {

    }

    @Override
    public void onPlayerKeyBindUp(Player player, int keyBindIndex) {

    }

    @Override
    public void onPlayerKeyBindDown(Player player, int keyBindIndex) {

    }

    @Override
    public boolean onPlayerPrivateMessage(Player player, Player recipient, String message) {

        return true;
    }

    @Override
    public boolean onPlayerMessage(Player player, String message) {

        return true;
    }

    @Override
    public void onPlayerAwayChange(Player player, boolean isAway) {

    }

    @Override
    public void onPlayerEndTyping(Player player) {

    }

    @Override
    public void onPlayerBeginTyping(Player player) {

    }

    @Override
    public void onPlayerGameKeysChange(Player player, int oldKeys, int newKeys) {

    }

    @Override
    public void onPlayerCrouchChange(Player player, boolean isCrouching) {

    }

    @Override
    public void onPlayerOnFireChange(Player player, boolean isOnFire) {

    }

    @Override
    public void onPlayerActionChange(Player player, int oldAction, int newAction) {

    }

    @Override
    public void onPlayerStateChange(Player player, int oldState, int newState) {

    }

    @Override
    public void onPlayerNameChange(Player player, String oldName, String newName) {

    }

    @Override
    public boolean onPlayerRequestEnterVehicle(Player player, Vehicle vehicle, int slot) {

        return true;
    }

    @Override
    public void onPlayerUpdate(Player player, int updateType) {

    }

    @Override
    public void onPlayerDeath(Player player, Player killer, int reason, int bodyPart) {

    }

    @Override
    public boolean onPlayerRequestSpawn(Player player) {

        return true;
    }

    @Override
    public boolean onPlayerRequestClass(Player player, int classIndex) {

        return true;
    }

    @Override
    public void onClientScriptData(Player player, byte[] data) {
        this.onClientData.onClientScriptData(player, data);
    }

    @Override
    public void onPluginCommand(int identifier, String message) {

    }

    @Override
    public void onServerShutdown() {

    }

}
[/noae]

com.rcnr.events.ClientEventController
[noae]/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.rcnr.events;
import com.google.common.io.LittleEndianDataInputStream;
import com.maxorator.vcmp.java.plugin.integration.player.Player;
import java.io.ByteArrayInputStream;
import java.io.DataInput;
import java.io.IOException;
/**
 *
 * @author NicusorN5
 */

public class ClientDataController {

   
    public ClientDataController() {
       
    }

    public void onClientScriptData(Player player, byte[] data) {

        DataInput input = new LittleEndianDataInputStream(new ByteArrayInputStream(data));
        try {
            int type = input.readInt();
        } catch (IOException ex) {
            ex.printStackTrace();
        }

    }

}
[/noae]

NewK

Your classPath is wrong, it should have the .jar name there. Will probably be something like:
classPath="C:\Users\NicusorN5\Desktop\Romania Cops N Robbers Remastered\RCNRRemastered\dist\RCNRRemastered.jar"

NicusorN5

Same thing:
Config:
jvmLibPath=C:\Program Files\Java\jre1.8.0_151\bin\server\jvm.dll
mainEventsClass=com.rcnr.events.MainController
classPath="C:\Users\NicusorN5\Desktop\Romania Cops N Robbers Remastered\RCNRRemastered\dist\RCNRRemastered.jar"
maxMemory=50m

1535009589691:  INFO - (VcmpPluginInit) VC:MP Java integration plugin loading...
1535009589697:  INFO - (JavaCore::LoadLibraryFunctions) Java VM library loaded.
1535009589697:  INFO - (JavaCore::LoadLibraryFunctions) Java VM library functions loaded.
1535009589697:  INFO - (JavaCore::SetupJVMArguments) Java VM settings initialized.
1535009590011:  INFO - (JavaCore::CreateJVM) Java VM created.
1535009590011:  INFO - (JavaCore::AttachThreadToJVM) Server thread attached to VM.
1535009590034: ERROR - (JavaExceptionHandler::Initialise) Exception in Java code
java.lang.NoClassDefFoundError: com/maxorator/vcmp/java/plugin/exceptions/DeadEntityException
Caused by: java.lang.ClassNotFoundException: com.maxorator.vcmp.java.plugin.exceptions.DeadEntityException
    java.net.URLClassLoader.findClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
    sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    java.lang.ClassLoader.loadClass(Unknown Source)
1535009590034: ERROR - (JavaExceptionHandler::Initialise) Exception classes not found (ThreadSafetyException, DeadEntityException, NullPointerException).
1535009590034: ERROR - (JavaCore::Initialise) Setting up exception handler failed.
1535009590034: ERROR - (JavaEventProxy::StartVM) JavaCore initialisation failed.

NewK

Now that I think about it, I don't think you can use quotes on the classPath. Try to remove the quotes and if that doesn't work, change the folder name of "Romania Cops N Robbers Remastered" and remove all the spaces, and then change it on the properties file like:

classPath=C:\Users\NicusorN5\Desktop\RomaniaCopsNRobbersRemastered\RCNRRemastered\dist\RCNRRemastered.jar
Also check if the jvm.dll file exists on the "C:\Program Files\Java\jre1.8.0_151\bin\server\jvm.dll" directory and if the RCNRRemastered.jar actually exists on the directory you specifed on classPath.

NicusorN5

Quote from: NewK on Aug 23, 2018, 07:58 AMNow that I think about it, I don't think you can use quotes on the classPath. Try to remove the quotes and if that doesn't work, change the folder name of "Romania Cops N Robbers Remastered" and remove all the spaces, and then change it on the properties file like:

classPath=C:\Users\NicusorN5\Desktop\RomaniaCopsNRobbersRemastered\RCNRRemastered\dist\RCNRRemastered.jar
Also check if the jvm.dll file exists on the "C:\Program Files\Java\jre1.8.0_151\bin\server\jvm.dll" directory and if the RCNRRemastered.jar actually exists on the directory you specifed on classPath.
Removed the spaces and the quotes on the javaplugin file, renamed the directory, and double checked if the files exist. I think that there's something wrong with the plugin or with my Java code.

javaplugin.proporties
jvmLibPath=C:\Program Files\Java\jre1.8.0_151\bin\server\jvm.dll
mainEventsClass=com.rcnr.events.MainController
classPath=C:\Users\NicusorN5\Desktop\RomaniaCopsNRobbersRemastered\RCNRRemastered\dist\RCNRRemastered.jar
maxMemory=50m

Before you ask me, I'm very sure that the paths are correct.

NewK

Well I don't think there's anything wrong with the plugin since it works on my netbeans project.

If you compiled the netbeans project and you're absolutely sure that RCNRRemastered.jar is on :C:\Users\NicusorN5\Desktop\RomaniaCopsNRobbersRemastered\RCNRRemastered\dist\And that jvm.dll is on:
C:\Program Files\Java\jre1.8.0_151\bin\server\Then make sure that:
  • You are using the correct plugin for your OS architecture. Is your OS 32bit or 64bit?. Make sure to use the correct plugin for each
  • You are using windows EOL's on the server.cfg and javaplugin.properties files. Since you're on windows you should make sure it's using \r\n EOL. You can use notepad++ to do the conversion:

NicusorN5

Yeah, It's better if I stick to Squirrel.