Jump to content
  • 0
Sign in to follow this  
Rimv911

Server Launch Error On VPS

Question

I try to run the server and im getting this error
[CODE]Exception in thread "main" java.lang.NoClassDefFoundError: dragonkk.rs2rsps.net.ServerChannelHandler
at dragonkk.rs2rsps.Server.<init>(Server.java:113)
at dragonkk.rs2rsps.Server.main(Server.java:120)
[/CODE]

Could anyone help me? I can't solve this on my own..

Share this post


Link to post
Share on other sites

16 answers to this question

Recommended Posts

  • 0
[quote name='Rimv911']I try to run the server and im getting this error
[CODE]Exception in thread "main" java.lang.NoClassDefFoundError: dragonkk.rs2rsps.net.ServerChannelHandler
at dragonkk.rs2rsps.Server.<init>(Server.java:113)
at dragonkk.rs2rsps.Server.main(Server.java:120)
[/CODE]

Could anyone help me? I can't solve this on my own..[/QUOTE]

Make sure your the file ServerChannelHandler is located in the directory dragonkk.rs2rsps.net.ServerChannelHandler

Share this post


Link to post
Share on other sites
  • 0
[quote name='crezzy']Make sure your the file ServerChannelHandler is located in the directory dragonkk.rs2rsps.net.ServerChannelHandler[/QUOTE]

I'am 100% it is because when i run it on my win7 it loads without any error or warnings, but on centOS VPS it give me this error? Those it make any difference if i compile the server in the VPS? Because i compiled it and uploaded it to the VPS..

Share this post


Link to post
Share on other sites
  • 0
[quote name='Rimv911']I'am 100% it is because when i run it on my win7 it loads without any error or warnings, but on centOS VPS it give me this error? Those it make any difference if i compile the server in the VPS? Because i compiled it and uploaded it to the VPS..[/QUOTE]

Have you converted your run.bat to run.sh correctly?
Or make sure that the compiled file is in the bin folder.

take a look at this: [URL="http://javarevisited.blogspot.co.uk/2011/06/noclassdeffounderror-exception-in.html"]http://javarevisited.blogspot.co.uk/2011/06/noclassdeffounderror-exception-in.html[/URL] Edited by crezzy

Share this post


Link to post
Share on other sites
  • 0
DAT MisPost... Edited by Rimv911

Share this post


Link to post
Share on other sites
  • 0
[quote name='crezzy']Have you converted your run.bat to run.sh correctly?
Or make sure that the compiled file is in the bin folder.

take a look at this: [URL="http://javarevisited.blogspot.co.uk/2011/06/noclassdeffounderror-exception-in.html"]http://javarevisited.blogspot.co.uk/2011/06/noclassdeffounderror-exception-in.html[/URL][/QUOTE]

This is how the .sh looks like:
[CODE]java -Xmx512m -classpath bin:lib/* dragonkk.rs2rsps.Server[/CODE]
This is how the bat looks like:
[CODE]@echo off
title Running...
"C:\Program Files\Java\jre7\bin\java.exe" -Xmx512m -cp bin;lib/* dragonkk.rs2rsps.Server
pause[/CODE]

You see I compiled the server on my pc and [B][COLOR="#FF0000"]not[/COLOR][/B] on the acctual VPS, but I don't know if thats the case.
And on the VPS it start loading the server, but when it gets to ServerChannelHandler it gives me that error. :/

Share this post


Link to post
Share on other sites
  • 0
[quote name='Rimv911']This is how the .sh looks like:
[CODE]java -Xmx512m -classpath bin:lib/* dragonkk.rs2rsps.Server[/CODE]
This is how the bat looks like:
[CODE]@echo off
title Running...
"C:\Program Files\Java\jre7\bin\java.exe" -Xmx512m -cp bin;lib/* dragonkk.rs2rsps.Server
pause[/CODE]

You see I compiled the server on my pc and [B][COLOR="#FF0000"]not[/COLOR][/B] on the acctual VPS, but I don't know if thats the case.
And on the VPS it start loading the server, but when it gets to ServerChannelHandler it gives me that error. :/[/QUOTE]

Umm paste your serverChannelHandler I'll take a look for you.

Share this post


Link to post
Share on other sites
  • 0
[quote name='crezzy']Umm paste your serverChannelHandler I'll take a look for you.[/QUOTE]

[CODE]package dragonkk.rs2rsps.net;

import dragonkk.rs2rsps.io.InStream;
import dragonkk.rs2rsps.model.World;
import dragonkk.rs2rsps.model.player.Player;
import dragonkk.rs2rsps.net.codec.ConnectionHandler;
import dragonkk.rs2rsps.net.codec.ConnectionWorker;
import dragonkk.rs2rsps.util.Logger;
import org.jboss.netty.bootstrap.ServerBootstrap;
import org.jboss.netty.buffer.ChannelBuffer;
import org.jboss.netty.channel.*;
import org.jboss.netty.channel.socket.nio.NioServerSocketChannelFactory;

import java.net.InetSocketAddress;
import java.util.concurrent.Executors;

[MENTION=47027]chan[/MENTION]nelPipelineCoverage("all")
public class ServerChannelHandler extends SimpleChannelHandler {

public ServerChannelHandler() {
ServerBootstrap bootstrap = new ServerBootstrap(new NioServerSocketChannelFactory(Executors.newCachedThreadPool(), Executors.newCachedThreadPool()));
bootstrap.getPipeline().addLast("handler", this);
bootstrap.setOption("child.tcpNoDelay", true);
bootstrap.bind(new InetSocketAddress(43594));
Logger.log(this, "Loaded port 43594");
}

[MENTION=15855]Over[/MENTION]ride
public final void channelConnected(ChannelHandlerContext ctx, ChannelStateEvent e) {
Channel channel = e.getChannel();
int count = 0;
String host = channel.getRemoteAddress().toString();
host = host.substring(1, host.indexOf(':'));
if (World.PermbannedIpsContain(host)) {
e.getChannel().close();
return;
}
for (Player player : World.getPlayers()) {
String playerHost = player.getConnection().getChannel().getRemoteAddress().toString();
playerHost = playerHost.substring(1, playerHost.indexOf(':'));
if (playerHost.equals(host)) {
if (++count == 6) {
channel.close();
return;
}
}
}
ConnectionHandler connection = new ConnectionHandler(channel);
ctx.setAttachment(connection);
}

[MENTION=15855]Over[/MENTION]ride
public final void channelDisconnected(ChannelHandlerContext ctx, ChannelStateEvent e) {
ConnectionHandler p = (ConnectionHandler) ctx.getAttachment();
if (p != null) {
World.unRegisterConnection(p);
ctx.setAttachment(null);
}
}

[MENTION=15855]Over[/MENTION]ride
public final void exceptionCaught(ChannelHandlerContext ctx, ExceptionEvent ee) throws Exception {
}

[MENTION=15855]Over[/MENTION]ride
public final void messageReceived(ChannelHandlerContext ctx, MessageEvent e) {
ConnectionHandler p = (ConnectionHandler) ctx.getAttachment();
ChannelBuffer buf = (ChannelBuffer) e.getMessage();
buf.markReaderIndex();
int avail = buf.readableBytes();
if (avail > 5000) {
e.getChannel().close();
return;
}

byte[] b = new byte[avail];
buf.readBytes(b);
InStream in = new InStream(b);
if (p.getPlayer() == null) {
ConnectionWorker.run(p, in);
} else {
Packets.run(p, in);
}
}

}
[/CODE]

Share this post


Link to post
Share on other sites
  • 0
[quote name='Rimv911']I try to run the server and im getting this error
[CODE]Exception in thread "main" java.lang.NoClassDefFoundError: dragonkk.rs2rsps.net.ServerChannelHandler
at dragonkk.rs2rsps.Server.<init>(Server.java:113)
at dragonkk.rs2rsps.Server.main(Server.java:120)
[/CODE]

Could anyone help me? I can't solve this on my own..[/QUOTE]

'NoClassDefFoundError'

Go to bin.dragonkk.rs2rsps.net

See if the ServerChannelHandler is in there.

Share this post


Link to post
Share on other sites
  • 0
Umm seems fine. well I just looked the error up for you and this is what it means:
[QUOTE]NoClassDefFoundError in Java comes when Java Virtual Machine is not able to find a particular class at runtime which was available during compile time. For example if we have a method call from a class or accessing any static member of a Class and that class is not available during run-time then JVM will throw NoClassDefFoundError. It’s important to understand that this is different than ClassNotFoundException which comes while trying to load a class at run-time only and name was provided during runtime not on compile time. Many Java developer mingle this two Error and gets confused.

In short NoClassDefFoundError will come if a class was present during compile time but not available in java classpath during runtime. Normally you will see below line in log when you get NoClassDefFoundError:[/QUOTE]

[B]I suggest compiling the server again on the vps[/B]

Share this post


Link to post
Share on other sites
  • 0
[quote name='Yaymyshow']'NoClassDefFoundError'

Go to bin.dragonkk.rs2rsps.net

See if the ServerChannelHandler is in there.[/QUOTE]

already told him todo that lol

Share this post


Link to post
Share on other sites
Sign in to follow this  

×