Sorry for the double post but I wonder if there is a way to configure Torque to not use its own connection pooling. I've never had any problems using Resin's connection pooling. How can I override?
-----Original Message----- From: Tony Spencer [mailto:tony@;tonyspencer.com] Sent: Wednesday, November 06, 2002 1:14 PM To: Turbine Torque Users List Subject: RE: Connection object null after some idle Thanks for looking at this but that didn't cure it. I tried it but still experience the same problem. On my test machine I've never seen this problem but on my hosted server (shared hosting) I see it pretty regularly with the exact same properties file. Here is the full stack trace: ERROR in HousingActions.getHousing java.lang.NullPointerException: Connection object was null. This could be due to a misconfiguration of the DataSourceFactory. Check the logs and Torque.properties to better determine the cause. at org.apache.torque.util.Transaction.rollback(Transaction.java:179) at org.apache.torque.util.BasePeer.doSelect(BasePeer.java:1272) at org.apache.torque.BaseHousingPeer.doSelectVillageRecords(BaseHousingPeer.jav a:402) at org.apache.torque.BaseHousingPeer.doSelectVillageRecords(BaseHousingPeer.jav a:373) at org.apache.torque.BaseHousingPeer.doSelect(BaseHousingPeer.java:352) at com.raleigh.objects.HousingActions.getHousingList(HousingActions.java:31) at _datalist__html._jspService(_datalist__html.java:64) at com.caucho.jsp.JavaPage.service(JavaPage.java:75) at com.caucho.jsp.Page.subservice(Page.java:486) at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182) at com.caucho.server.http.Invocation.service(Invocation.java:311) at com.caucho.server.http.QRequestDispatcher.include(QRequestDispatcher.java:35 8) at com.caucho.server.http.QRequestDispatcher.include(QRequestDispatcher.java:26 5) at com.caucho.jsp.QPageContext.include(QPageContext.java:490) at _housing._aptavail._index__html._jspService(_index__html.java:28) at com.caucho.jsp.JavaPage.service(JavaPage.java:75) at com.caucho.jsp.Page.subservice(Page.java:486) at com.caucho.server.http.FilterChainPage.doFilter(FilterChainPage.java:182) at com.caucho.server.http.Invocation.service(Invocation.java:311) at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:342) at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:272 ) at com.caucho.server.TcpConnection.run(TcpConnection.java:137) at java.lang.Thread.run(Thread.java:536) Last night I encountered another ugly exception as well. I've never seen this one before: 178879540 [tcpConnection-17221-1] ERROR util.Transaction - An attempt was made to rollback a transaction but the database did not a llow the operation to be rolled back. java.sql.SQLException: Attempted to use Connection after closed() was called. at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.assertOpen(ConnectionImpl .java:140) at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.getMetaData(ConnectionImp l.java:253) at org.apache.torque.util.Transaction.rollback(Transaction.java:188) at org.apache.torque.util.Transaction.safeRollback(Transaction.java:221) at org.apache.torque.BasePersonals.save(BasePersonals.java:1004) at org.apache.torque.BasePersonals.save(BasePersonals.java:979) at com.raleigh.objects.PersonalsActions.createPersonals(PersonalsActions.java:1 44) at com.raleigh.servlets.PostServlet.doPost(PostServlet.java:218) at javax.servlet.http.HttpServlet.service(HttpServlet.java:165) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:9 6) at com.caucho.server.http.Invocation.service(Invocation.java:311) at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:342) at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:272 ) at com.caucho.server.TcpConnection.run(TcpConnection.java:137) at java.lang.Thread.run(Thread.java:536) 178879555 [tcpConnection-17221-1] ERROR util.Transaction - An error occured during rollback. java.sql.SQLException: Attempted to use Connection after closed() was called . at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.assertOpen(ConnectionImpl .java:140) at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.getMetaData(ConnectionImp l.java:253) at org.apache.torque.util.Transaction.rollback(Transaction.java:188) at org.apache.torque.util.Transaction.safeRollback(Transaction.java:221) at org.apache.torque.BasePersonals.save(BasePersonals.java:1004) at org.apache.torque.BasePersonals.save(BasePersonals.java:979) at com.raleigh.objects.PersonalsActions.createPersonals(PersonalsActions.java:1 44) at com.raleigh.servlets.PostServlet.doPost(PostServlet.java:218) at javax.servlet.http.HttpServlet.service(HttpServlet.java:165) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:9 6) at com.caucho.server.http.Invocation.service(Invocation.java:311) at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:342) at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:272 ) at com.caucho.server.TcpConnection.run(TcpConnection.java:137) at java.lang.Thread.run(Thread.java:536) rethrown as org.apache.torque.TorqueException: Attempted to use Connection after closed() was called. at org.apache.torque.util.Transaction.rollback(Transaction.java:203) at org.apache.torque.util.Transaction.safeRollback(Transaction.java:221) at org.apache.torque.BasePersonals.save(BasePersonals.java:1004) at org.apache.torque.BasePersonals.save(BasePersonals.java:979) at com.raleigh.objects.PersonalsActions.createPersonals(PersonalsActions.java:1 44) at com.raleigh.servlets.PostServlet.doPost(PostServlet.java:218) at javax.servlet.http.HttpServlet.service(HttpServlet.java:165) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:9 6) at com.caucho.server.http.Invocation.service(Invocation.java:311) at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:342) at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:272 ) at com.caucho.server.TcpConnection.run(TcpConnection.java:137) at java.lang.Thread.run(Thread.java:536) Caused by: java.sql.SQLException: Attempted to use Connection after closed() was called. at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.assertOpen(ConnectionImpl .java:140) at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.getMetaData(ConnectionImp l.java:253) at org.apache.torque.util.Transaction.rollback(Transaction.java:188) ... 13 more ERROR in PersonalsActions.createPersonals java.sql.SQLException: Communication link failure: java.io.IOException at org.gjt.mm.mysql.MysqlIO.sendCommand(Unknown Source) at org.gjt.mm.mysql.MysqlIO.sqlQueryDirect(Unknown Source) at org.gjt.mm.mysql.MysqlIO.sqlQuery(Unknown Source) at org.gjt.mm.mysql.Connection.execSQL(Unknown Source) at org.gjt.mm.mysql.Connection.execSQL(Unknown Source) at org.gjt.mm.mysql.Connection.setAutoCommit(Unknown Source) at org.apache.commons.dbcp.cpdsadapter.ConnectionImpl.setAutoCommit(ConnectionI mpl.java:415) at org.apache.torque.pool.TorqueClassicDataSource.getConnection(TorqueClassicDa taSource.java:462) at org.apache.torque.pool.TorqueClassicDataSource.getConnection(TorqueClassicDa taSource.java:435) at org.apache.torque.Torque.getConnection(Torque.java:909) at org.apache.torque.util.Transaction.beginOptional(Transaction.java:113) at org.apache.torque.oid.IDBroker.storeIDs(IDBroker.java:657) at org.apache.torque.oid.IDBroker.getNextIds(IDBroker.java:443) at org.apache.torque.oid.IDBroker.getIdAsBigDecimal(IDBroker.java:330) at org.apache.torque.util.BasePeer.doInsert(BasePeer.java:702) at org.apache.torque.BasePersonalsPeer.doInsert(BasePersonalsPeer.java:233) at org.apache.torque.BasePersonalsPeer.doInsert(BasePersonalsPeer.java:542) at org.apache.torque.BasePersonals.save(BasePersonals.java:1037) at org.apache.torque.BasePersonals.save(BasePersonals.java:999) at org.apache.torque.BasePersonals.save(BasePersonals.java:979) at com.raleigh.objects.PersonalsActions.createPersonals(PersonalsActions.java:1 44) at com.raleigh.servlets.PostServlet.doPost(PostServlet.java:218) at javax.servlet.http.HttpServlet.service(HttpServlet.java:165) at javax.servlet.http.HttpServlet.service(HttpServlet.java:103) at com.caucho.server.http.FilterChainServlet.doFilter(FilterChainServlet.java:9 6) at com.caucho.server.http.Invocation.service(Invocation.java:311) at com.caucho.server.http.RunnerRequest.handleRequest(RunnerRequest.java:342) at com.caucho.server.http.RunnerRequest.handleConnection(RunnerRequest.java:272 ) at com.caucho.server.TcpConnection.run(TcpConnection.java:137) at java.lang.Thread.run(Thread.java:536) -----Original Message----- From: CP Lim [mailto:cp_lim@;redsheriff.com] Sent: Sunday, November 03, 2002 4:54 PM To: Turbine Torque Users List Subject: Re: Connection object null after some idle Hi Tony, I think you might have a misconfiguration on your hands. The *.dsfactory.* entries are ok as far as I can tell, but the following entries have to be like this: --------------------------------------------------- torque.database.default=tonys_raleigh torque.database.default.adapter=mysql --------------------------------------------------- I've experienced your problem before (java.lang.NullPointerException), and what is happening is that because Torque tries to determine your database by looking up the entry 'torque.database.default.adapter', finding nothing (as it was configured as 'torque.database.tonys_raleigh.adapter'), it will default to the DBNone adaptor as opposed to DBMM (MySQL). I must admit I am a little curious as to how it managed to work properly at all.... Anyway, hope this helps. cheers, CP Tony Spencer wrote: > I've searched the archives so forgive me if this has already been discussed. > > I am running Torque with Resin. Everything runs beautifully but I have a > weird case in which the retrieved connection from the pool is sometimes > null. It always occurs when the app has been idle for some time (20 minutes > or so) and it never occurs twice in a row. > > For instance, if the app has been idle for 20 minutes (with no requests from > the db) and I click on a link that does a select I get the exception: > > java.lang.NullPointerException: Connection object was null. This could be > due to a misconfiguration of the DataSourceFactory. Check the logs and > Torque.properties to better determine the cause. > > Clicking the link just once more or hitting refresh does not result in any > exception and everything functions properly. You can do all kinds of > database activity after the one exception and never get the exception again. > > The null connection object after an idle period is always consistent. I can > hack the code to try to get the connection a couple of times but I was > hoping someone was familiar with this problem or perhaps it is bug. > > Also, I am not clear as to whether I should use the TorqueDataSourceFactory > or Jdbc2PoolDataSourceFactory. I've tried both and experience the same > problem with both. > > Here are my current pooling properties: > > torque.database.tonys_raleigh.adapter=mysql > > torque.dsfactory.tonys_raleigh.factory=org.apache.torque.dsfactory.TorqueDat > aSourceFactory > torque.dsfactory.tonys_raleigh.pool.defaultMaxConnections=10 > torque.dsfactory.tonys_raleigh.pool.maxExpiryTime=3600 > torque.dsfactory.tonys_raleigh.pool.connectionWaitTimeout=10 > torque.dsfactory.tonys_raleigh.connection.driver = org.gjt.mm.mysql.Driver > torque.dsfactory.tonys_raleigh.connection.url = > jdbc:mysql://localhost/tonys_raleigh > torque.dsfactory.tonys_raleigh.connection.user = tonys_tspencer > torque.dsfactory.tonys_raleigh.connection.password = mypass > > And here is what I'm using: > Torque 3.0 rc1 > Resin 2.1.1 > MySql 3.23.53a > JDBC: MySql Connector/J2 (2.0.14) > > > Much thanks in advance, > Tony > > > -- > To unsubscribe, e-mail: <mailto:turbine-torque-user-unsubscribe@;jakarta.apache.org> > For additional commands, e-mail: <mailto:turbine-torque-user-help@;jakarta.apache.org> > > > -- R E D S H E R I F F C.P. Lim - Software Engineer Level 1, 10 Queens Road +61 3 9864 0733 tel Melbourne VIC +61 3 9864 0778 fax Australia +61 413 781 846 mob This message and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you are not the intended recipient, you are hereby notified that any use or dissemination of this communication is strictly prohibited. If you have received this message in error please notify us immediately by return email or telephone +61 (3) 9659 0432, then delete this message. Any views expressed in this message are those of the individual sender and many not necessarily reflect the views of Red Sheriff. -- To unsubscribe, e-mail: <mailto:turbine-torque-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:turbine-torque-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:turbine-torque-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:turbine-torque-user-help@;jakarta.apache.org> -- To unsubscribe, e-mail: <mailto:turbine-torque-user-unsubscribe@;jakarta.apache.org> For additional commands, e-mail: <mailto:turbine-torque-user-help@;jakarta.apache.org>
