| Bug #29106 | Ping failed in com.mysql.jboss.MysqlValidConnectionChecker | ||
|---|---|---|---|
| Submitted: | 14 Jun 2007 14:07 | Modified: | 29 Aug 2007 19:38 | 
| Reporter: | Fabien Carrion | Email Updates: | |
| Status: | Closed | Impact on me: | |
| Category: | Connector / J | Severity: | S2 (Serious) | 
| Version: | 5.1.0 | OS: | Any (Windows & linux) | 
| Assigned to: | CPU Architecture: | Any | |
   [19 Jun 2007 19:48]
   Tonci Grgin        
  Hi Fabien and thanks for your report. After consulting on this I will set it to verified although it sounds like bug with reflection.
   [29 Aug 2007 19:27]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/33386
   [29 Aug 2007 19:32]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/33387
   [29 Aug 2007 19:38]
   Fabien Carrion        
  Thanks for the patch. This is working now.
   [29 Aug 2007 19:43]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/33388
   [31 Aug 2007 14:16]
   MC Brown        
  Added a note to the 5.0.8 changelog: Connection checker for JBoss didn't use same method parameters via reflection, causing connections to always seem "bad".
   [6 Sep 2007 15:13]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/33832
   [7 Sep 2007 14:03]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/33909
   [3 Oct 2007 16:41]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/34839
   [3 Oct 2007 16:46]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/34840
   [3 Oct 2007 18:59]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/34855
   [5 Oct 2007 18:53]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/35011
   [11 Oct 2007 20:10]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/35407
   [11 Oct 2007 20:24]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/35410
   [11 Oct 2007 20:52]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/35414
   [7 Nov 2007 16:42]
   Rafal Boniecki        
  I'm still getting this exception with 5.0.8 and 5.1.5 driver when using mysql as persistent store for JMS messages with JBoss Messaging. Full stack trace included in attachment.
   [7 Nov 2007 16:43]
   Rafal Boniecki        
  Full stack trace of error.
Attachment: exception.txt (text/plain), 15.14 KiB.
   [7 Nov 2007 16:45]
   Rafal Boniecki        
  Datasource xml
Attachment: mysql-ds.xml (text/xml), 776 bytes.
   [8 Nov 2007 7:38]
   Tonci Grgin        
  Thanks for following up on this. I'll forward it to our Java gurus.
   [15 Nov 2007 13:52]
   Rafal Boniecki        
  Problem solved. I had wait_timeout set to 60s in my mysql database. I had not specified idle-timeout-minutes parameter in my mysql datascource, so it was using default value probably larger than wait_timeout in mysql. Setting idle-timeout-minutes to value smaller than wait_timeout solved this issue for me:) Now VAlidConnectionchecker is silent because datasource pool always closes connection before MySQL does.
   [16 Nov 2007 9:38]
   Tonci Grgin        
  Rafal, thanks for your feedback. Others may profit from it. Thanks for your interest in MySQL.
   [19 Nov 2007 0:57]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/38019
   [19 Nov 2007 2:51]
   Bugs System        
  A patch for this bug has been committed. After review, it may be pushed to the relevant source trees for release in the next version. You can access the patch from: http://lists.mysql.com/commits/38024
   [9 Oct 2008 8:39]
   abhijit ohal        
  Hello I got same exception on our server & UI get slower. I was able to reproduce this exception on my local system. but didn't get why UI should go slow . I have tried mysql-connector-java-5.1.6 & got same behaviour. Is there any solution to this issue? Regards Abhijit
   [9 Oct 2008 11:00]
   Tonci Grgin        
  Abhijit, problem is *solved*, please review the entire report and check on your code as suggested.


Description: I configure a data source connection in jboss to access to the mysql database. I configure it with the option <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name> I get the following error: java.sql.SQLException: Ping failed: java.lang.reflect.InvocationTargetException at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:914) at com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker.isValidConnection(MysqlValidConnectionChecker.java:88) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:435) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:231) at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.getInvalidConnections(BaseWrapperManagedConnectionFactory.java:346) at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.validateConnections(InternalManagedConnectionPool.java:650) at org.jboss.resource.connectionmanager.ConnectionValidator$ConnectionValidatorRunnable.run(ConnectionValidator.java:178) at java.lang.Thread.run(Thread.java:619) How to repeat: Just take a jboss server and configure it with this: <?xml version="1.0" encoding="UTF-8"?> <datasources> <local-tx-datasource> <jndi-name>datasource3</jndi-name> <connection-url>jdbc:mysql://localhost:3306/sampledata</connection-url> <driver-class>com.mysql.jdbc.Driver</driver-class> <user-name>user</user-name> <password>password</password> <min-pool-size>5</min-pool-size> <max-pool-size>20</max-pool-size> <idle-timeout-minutes>5</idle-timeout-minutes> <background-validation>true</background-validation> <background-validation-minutes>10</background-validation-minutes> <exception-sorter-class-name>com.mysql.jdbc.integration.jboss.ExtendedMysqlExceptionSorter</exception-sorter-class-name> <valid-connection-checker-class-name>com.mysql.jdbc.integration.jboss.MysqlValidConnectionChecker</valid-connection-checker-class-name> </local-tx-datasource> </datasources> Suggested fix: In the class com.mysql.jboss.MysqlValidConnectionChecker line 80, you have this.pingMethod.invoke(conn, NO_ARGS_OBJECT_ARRAY); I would put this.pingMethod.invoke(conn, null); because you have this before pingMethod = mysqlConnection.getMethod("ping", null); And then it works for me.