I made a custom login, and it seems to work 10 times but on the 11th time I get this msg:
Code: Select all
jvm 1 | 23:34:31.413 - [ WARNING ] > Could not retrieve a database connection: org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
jvm 1 | org.apache.commons.dbcp.SQLNestedException: Cannot get a connection, pool exhausted
jvm 1 | at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:183)
jvm 1 | at java.sql.DriverManager.getConnection(Unknown Source)
jvm 1 | at java.sql.DriverManager.getConnection(Unknown Source)
jvm 1 | at it.gotoandplay.smartfoxserver.db.DbManager.getConnection(DbManager.java:218)
jvm 1 | at sacredseasons.Database.tryLogin(Database.java:28)
jvm 1 | at sacredseasons.Login.loginRequest(Login.java:93)
jvm 1 | at sacredseasons.Login.handleInternalEvent(Login.java:75)
jvm 1 | at it.gotoandplay.smartfoxserver.controllers.MessageHandler.dispatchEvent(MessageHandler.java:141)
jvm 1 | at it.gotoandplay.smartfoxserver.controllers.SystemHandler.handleLoginRequest(SystemHandler.java:439)
jvm 1 | at it.gotoandplay.smartfoxserver.controllers.SystemHandler.processEvent(SystemHandler.java:194)
jvm 1 | at it.gotoandplay.smartfoxserver.controllers.SystemHandler.run(SystemHandler.java:143)
jvm 1 | at java.lang.Thread.run(Unknown Source)
jvm 1 | Caused by: java.util.NoSuchElementException
jvm 1 | at org.apache.commons.pool.impl.GenericObjectPool.borrowObject(GenericObjectPool.java:744)
jvm 1 | at org.apache.commons.dbcp.PoolingDriver.connect(PoolingDriver.java:175)
jvm 1 | ... 11 more
jvm 1 | java.lang.NullPointerException
jvm 1 | at sacredseasons.Database.tryLogin(Database.java:32)
jvm 1 | at sacredseasons.Login.loginRequest(Login.java:93)
jvm 1 | at sacredseasons.Login.handleInternalEvent(Login.java:75)
jvm 1 | at it.gotoandplay.smartfoxserver.controllers.MessageHandler.dispatchEvent(MessageHandler.java:141)
jvm 1 | at it.gotoandplay.smartfoxserver.controllers.SystemHandler.handleLoginRequest(SystemHandler.java:439)
jvm 1 | at it.gotoandplay.smartfoxserver.controllers.SystemHandler.processEvent(SystemHandler.java:194)
jvm 1 | at it.gotoandplay.smartfoxserver.controllers.SystemHandler.run(SystemHandler.java:143)
jvm 1 | at java.lang.Thread.run(Unknown Source)
jvm 1 | 23:34:31.414 - [ WARNING ] > SystemHandler: Invalid login request > java.lang.NullPointerException
Code: Select all
Connection con=db.getConnection();now... if I don't use db.getConnection() I do not get this problem at all!!! but then I can't use the PreparedStatements...
so I don't mind not using db.getConnection() as long as there is a good way to clean (escape) strings before I put them into an sql statement!
Please advise me what to do!