Bug #8975 System crashes in ping() command
Submitted: 5 Mar 2005 10:15 Modified: 28 Mar 2014 11:16
Reporter: M Wensink Email Updates:
Status: Closed Impact on me:
None 
Category:Connector / J Severity:S1 (Critical)
Version:Latest snapshot OS:Microsoft Windows (w2k)
Assigned to: Alexander Soklakov CPU Architecture:Any

[5 Mar 2005 10:15] M Wensink
Description:
I am using MySql Connector/J in combination with Tomcat 5.5. Using the latest snapshot release, the system is unable to start.

The following Exception is thrown:
Mar 5, 2005 11:00:11 AM org.apache.catalina.core.ApplicationContext log
SEVERE: Error reading institutes: 
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception: 'java.sql.SQLException: No operations allowed after connection closed.'.

** BEGIN NESTED EXCEPTION ** 

java.sql.SQLException
MESSAGE: No operations allowed after connection closed.

STACKTRACE:

java.sql.SQLException: No operations allowed after connection closed.
	at com.mysql.jdbc.Connection.checkClosed(Connection.java:2726)
	at com.mysql.jdbc.Connection.ping(Connection.java:3470)
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:1892)
	at com.mysql.jdbc.Connection.<init>(Connection.java:430)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:268)
	at org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
	at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
	at frs.beans.institute.InstituteRegistryBean.getInstitutes(InstituteRegistryBean.java:68)
	at frs.servlets.ResourceManagerListener.contextInitialized(ResourceManagerListener.java:77)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3659)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4097)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
	at org.apache.catalina.core.StandardService.start(StandardService.java:450)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)

** END NESTED EXCEPTION **

It looks to me that the modification made to the ping() command, is not working well

How to repeat:
The error emerges every time I start the system.

Suggested fix:
Modify ping() command.
[5 Mar 2005 14:53] Mark Matthews
What does your JDBC url look like? Are you using autoReconnect?
[5 Mar 2005 15:23] M Wensink
This is the resource defined in the server.xml:

<Resource name="jdbc/flexlabDB" auth="Application" type="javax.sql.DataSource"
               maxActive="100" maxIdle="30" maxWait="10000"
               username="flexlab2mysql" password="Flexlab2MySQL" driverClassName="com.mysql.jdbc.Driver"
               removeAbandoned="true" logAbandoned="true"
               url="jdbc:mysql://localhost:3306/flexlab-db?autoReconnect=true&amp;max-connections=100&amp;min-connections=2&amp;inactivity-timeout=30&amp;wait-timeout=30&amp;zeroDateTimeBehavior=convertToNull"/>
[10 Mar 2005 21:30] M Wensink
I have seen that you tried to correct the ping problem, but unfortunately, I my system still cashes. I get net next stack trace.

SEVERE: Error reading institutes: 
org.apache.tomcat.dbcp.dbcp.SQLNestedException: Cannot create PoolableConnectionFactory (Server connection failure during transaction. Due to underlying exception: 'java.sql.SQLException: No operations allowed after connection closed.'.

** BEGIN NESTED EXCEPTION ** 

java.sql.SQLException
MESSAGE: No operations allowed after connection closed.

STACKTRACE:

java.sql.SQLException: No operations allowed after connection closed.
	at com.mysql.jdbc.Connection.checkClosed(Connection.java:2727)
	at com.mysql.jdbc.Connection.createStatement(Connection.java:1127)
	at com.mysql.jdbc.Connection.createStatement(Connection.java:1146)
	at com.mysql.jdbc.Connection.getMetadataSafeStatement(Connection.java:4735)
	at com.mysql.jdbc.Connection.pingInternal(Connection.java:3517)
	at com.mysql.jdbc.Connection.createNewIO(Connection.java:1893)
	at com.mysql.jdbc.Connection.<init>(Connection.java:431)
	at com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:268)
	at org.apache.tomcat.dbcp.dbcp.DriverConnectionFactory.createConnection(DriverConnectionFactory.java:37)
	at org.apache.tomcat.dbcp.dbcp.PoolableConnectionFactory.makeObject(PoolableConnectionFactory.java:290)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.validateConnectionFactory(BasicDataSource.java:877)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:851)
	at org.apache.tomcat.dbcp.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
	at frs.beans.institute.InstituteRegistryBean.getInstitutes(InstituteRegistryBean.java:68)
	at frs.servlets.ResourceManagerListener.contextInitialized(ResourceManagerListener.java:77)
	at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3659)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4097)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:718)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1012)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:442)
	at org.apache.catalina.core.StandardService.start(StandardService.java:450)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:683)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:537)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
	at java.lang.reflect.Method.invoke(Unknown Source)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:271)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:409)

** END NESTED EXCEPTION **
[11 Mar 2005 10:47] M Wensink
OK, tonights release works!
[14 Apr 2005 23:00] Bugs System
No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
[28 Mar 2014 11:16] Alexander Soklakov
Fixed in 3.0.17 and 3.1.8