Swaghetti 6 Posted August 29, 2018 Report Share Posted August 29, 2018 Could someone help me out, can't login because of the database? How do i setup this database or how do i login with ease? Could someone please help me out ? The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server. at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:400) at com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1038) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:339) at com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2247) at com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2280) at com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2079) at com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:794) at com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:423) at com.mysql.jdbc.Util.handleNewInstance(Util.java:400) at com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:399) at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325) at org.apache.commons.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:38) at org.apache.commons.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:582) at org.apache.commons.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:1556) at org.apache.commons.dbcp.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:1545) ... 12 more Caused by: java.net.ConnectException: Connection timed out: connect at java.net.DualStackPlainSocketImpl.connect0(Native Method) at java.net.DualStackPlainSocketImpl.socketConnect(DualStackPlainSocketImpl.java:79) at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:350) at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206) at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188) at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:172) at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392) at java.net.Socket.connect(Socket.java:589) at com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:214) at com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:298) ... 28 more aug 30, 2018 12:48:50 AM org.rs2server.rs2.ConnectionHandler closeSession INFO: Closing session for player null ConnectionHandler: package org.rs2server.rs2; import org.apache.mina.core.service.IoHandlerAdapter; import org.apache.mina.core.session.IdleStatus; import org.apache.mina.core.session.IoSession; import org.apache.mina.filter.codec.ProtocolCodecFilter; import org.rs2server.Server; import org.rs2server.rs2.domain.service.api.EngineService; import org.rs2server.rs2.model.World; import org.rs2server.rs2.model.player.Player; import org.rs2server.rs2.net.Packet; import org.rs2server.rs2.net.RS2CodecFactory; import org.rs2server.rs2.task.impl.SessionClosedTask; import org.rs2server.rs2.task.impl.SessionMessageTask; import org.rs2server.rs2.task.impl.SessionOpenedTask; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** * The <code>ConnectionHandler</code> processes incoming events from MINA, * submitting appropriate tasks to the <code>GameEngine</code>. * * @author Graham Edgecombe */ public class ConnectionHandler extends IoHandlerAdapter { private static final Logger logger = LoggerFactory.getLogger(ConnectionHandler.class); private final EngineService engineService; public ConnectionHandler() { this.engineService = Server.getInjector().getInstance(EngineService.class); } @Override public void exceptionCaught(IoSession session, Throwable throwable) throws Exception { // logger.error("Exception occurred in connection handler for player " + session.getAttribute("player"), throwable); closeSession(session); } @Override public void messageReceived(IoSession session, Object message) throws Exception { engineService.offerTask(new SessionMessageTask(session, (Packet) message)); } @Override public void sessionClosed(IoSession session) throws Exception { closeSession(session); } @Override public void sessionIdle(IoSession session, IdleStatus status) throws Exception { logger.info("Session idled for player {} with status {}, closing...", session.getAttribute("player"), status.toString()); Player player = (Player) session.getAttribute("player"); if (player != null) { engineService.offerTask(new SessionClosedTask(session, player)); } else { session.close(false); } } @Override public void sessionOpened(IoSession session) throws Exception { session.setAttribute("remote", session.getRemoteAddress()); session.getFilterChain().addFirst("protocol", new ProtocolCodecFilter(RS2CodecFactory.LOGIN)); engineService.offerTask(new SessionOpenedTask(session)); } private void closeSession(final IoSession session) { if (!session.isClosing()) { System.out.println("closed..."); session.close(false); } final Player player = (Player) session.getAttribute("player"); logger.info("Closing session for player {}", player); if (player != null) { engineService.offerTask(new SessionClosedTask(session, player)); // This ensures only a single session closed task will be processed at one single time. session.setAttribute("player", null); } else { for (Player p : World.getWorld().getPlayers()) { if (p.getSession() == session) { logger.info("Session closed via fallback."); engineService.offerTask(new SessionClosedTask(session, p)); break; } } } } } Mongodb setup, heres the db structure: Link to comment Share on other sites More sharing options...
KieranDevvs 1 Posted December 9, 2018 Report Share Posted December 9, 2018 I can't tell you exactly what your issue is as half of the code is missing to debug this however, it might be that you're using a single indefinite connection for all requests. If this is the case then you either want to establish a new connection for each request or look into connection pooling. (that's providing that my educated guess is correct). Link to comment Share on other sites More sharing options...
Mantvis 152 Posted December 9, 2018 Report Share Posted December 9, 2018 Pm me on discord i'll help you run it Mantvis#0948 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now