I'm making a game server which involves three servers; a CommonServer, which connects the LoginServer and the Gameserver.
Anyways, I've got another source that's similar that I'm looking at but I must have done something wrong. I've been looking at it over and over again and the other source works, but for some reason mine gives an error...
Here's my main method in the CommonServer, which binds it to the registry:
Relevant parts of my CommonRegistryImpl.java:Code:public static void main(String[] args) { try { Registry registry = LocateRegistry.createRegistry(Registry.REGISTRY_PORT, new SslRMIClientSocketFactory(), new SslRMIServerSocketFactory()); registry.rebind("CommonRegistry", CommonRegistryImpl.getInstance()); log.info("CommonServer loaded, waiting for LoginServer and GameServer to connect."); } catch (Exception e) { log.error("Could not initialize RMI system."); e.printStackTrace(); } }
The CommonServer seems to execute fine, but when I start up my LoginServer, it gives this stack trace:Code:public class CommonRegistryImpl extends UnicastRemoteObject implements CommonRegistry { private static CommonRegistryImpl instance; private CommonRegistryImpl() throws RemoteException { super(0, new SslRMIClientSocketFactory(), new SslRMIServerSocketFactory()); MySQLConnection.setProps(CommonServer.getInstance().getMySQLProperties()); } public static CommonRegistryImpl getInstance() { if (instance == null) { try { instance = new CommonRegistryImpl(); } catch (Exception e) { System.out.println("Error getting CommonRegistryImpl instance."); e.printStackTrace(); } } return instance; } }
Relevant parts of LoginServer's source code; just in case you miss it: "commonRegistry = (CommonRegistry) registry.lookup("CommonRegistry"); // THIS IS LINE 80 IN LoginServer.java"Code:30/05/2009 8:17:13 AM org.kodserver.server.login.LoginServer run SEVERE: Error starting up LoginServer. java.rmi.ConnectIOException: error during JRMP connection establishment; nested exception is: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_fai lure at sun.rmi.transport.tcp.TCPChannel.createConnection(Unknown Source) at sun.rmi.transport.tcp.TCPChannel.newConnection(Unknown Source) at sun.rmi.server.UnicastRef.newCall(Unknown Source) at sun.rmi.registry.RegistryImpl_Stub.lookup(Unknown Source) at org.kodserver.server.login.LoginServer.run(LoginServer.java:80) at org.kodserver.server.login.LoginServer.main(LoginServer.java:69) Caused by: javax.net.ssl.SSLHandshakeException: Received fatal alert: handshake_ failure at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source) at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.recvAlert(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.readRecord(Unknown Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.performInitialHandshake(Un known Source) at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source ) at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source) at java.io.BufferedOutputStream.flushBuffer(Unknown Source) at java.io.BufferedOutputStream.flush(Unknown Source) at java.io.DataOutputStream.flush(Unknown Source) ... 6 more
I just have no idea why it's giving that error. Help please? This is making me so frustrated >.<Code:public class LoginServer implements Runnable, LoginServerMBean { private static CommonRegistry commonRegistry; private static LoginServer instance = new LoginServer(); private LoginServer() { } public static LoginServer getInstance() { return instance; } public static void main(String[] args) { try { LoginServer.getInstance().run(); } catch (Exception e) { log.error("Couldn't start up LoginServer: " + e, e); } } @Override public void run() { try { Registry registry = LocateRegistry.getRegistry("127.0.0.1", Registry.REGISTRY_PORT, new SslRMIClientSocketFactory()); commonRegistry = (CommonRegistry) registry.lookup("CommonRegistry"); // THIS IS LINE 80 IN LoginServer.java lci = new LoginCommonInterfaceImpl(); cli = commonRegistry.registerLoginServer(lci); Properties dbProps = new Properties(); FileReader fr = new FileReader("MySQL.properties"); dbProps.load(fr); fr.close(); MySQLConnection.setProps(dbProps); MySQLConnection.getConnection(); } catch (Exception e) { log.error("Error starting up LoginServer."); e.printStackTrace(); } ByteBuffer.setUseDirectBuffers(false); ByteBuffer.setAllocator(new SimpleByteBufferAllocator()); acceptor = new SocketAcceptor(); SocketAcceptorConfig cfg = new SocketAcceptorConfig(); cfg.getFilterChain().addLast("codec", new ProtocolCodecFilter(new CodecFactory())); TimerManager.getInstance().start(); try { acceptor.bind(new InetSocketAddress(LOGINSERVER_PORT), new ServerHandler(PacketProcessor.getProcessor(PacketProcessor.Mode.LOGIN_SERVER)), cfg); log.info("LoginServer is up and running - listening on port {}", LOGINSERVER_PORT); } catch (IOException e) { log.error("Binding to port {} failed", LOGINSERVER_PORT, e); } } }


Reply With Quote


Bookmarks