'Connection has already been closed'. Random error connecting with a pool, platform i
posted 8 years ago
Hi all, I've got a problem I cannot solve, and really hope in someone's help... The fact is: I'm working on a webapp which doesn't made use of frameworks or patterns or similars. I introduced the DAO pattern in order to organize and speed up the work. At the core of the new classes there is the DBDAO, and this is the way it obtains the connection:
Every new class that needs to access the db extends DBDAO and retrieves the conn with this method. In order to make things work without changing all the code, I modified the old class named 'Connessione' and made it extend DBDAO. Here is its method:
That's all. Finished with the code. Now, if someone uses the new classes extending DBDAO, all goes well. But for some old function that still work with Connessione.getConnessione(), connection closes suddenly with no reason. For example, calling a page with some combo box populated with a db connection, you catch a:
That is, the conn is closed while used to populate the combo box. I don't understand who closes it. Moreover, that happens randomly: 1 or 2 times over 4 hits on the page. The other times, all goes well. Most of the other pages, all goes well. So I don't think I have to search for a bug in the code. Now, I'm working with BEA WL 8.1 sp 5 and Oracle 126.96.36.199.0 . The error turns out even if I work locally (with Tomcat 5.5.23). The webapp made use of a custom driver beforehand, and I replaced it with oracle's driver. I tried to set the Connection Pool with oracle.jdbc.driver.OracleDriver and oracle.jdbc.OracleDriver . I left the default for the connection pool, and then tried to set (BEA): Connection Reserve Timeout: -1 Test Created Connections: On with no changes.