Uploaded image for project: 'Application Server 3  4  5 and 6'
  1. Application Server 3 4 5 and 6
  2. JBAS-1927

MySQLValidConnectionChecker broken -> NullPointerException

XMLWordPrintable

      MySQLValidConnectionChecker does not work due to NullPointerException caused by the following code:

      Integer status = (Integer) ping.invoke(c, params);
      if (status.intValue() < 0)

      Because the mysql driver ping method has signature of:

      public void ping() throws java.sql.SQLException;

      which means status will be null.

      Here is an example stacktrace:

      java.lang.NullPointerException
      at org.jboss.resource.adapter.jdbc.vendor.MySQLValidConnectionChecker.isValidConnection(MySQLValidConnectionChecker.java:61)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnectionFactory.isValidConnection(BaseWrapperManagedConnectionFactory.java:482)
      at org.jboss.resource.adapter.jdbc.BaseWrapperManagedConnection.checkValid(BaseWrapperManagedConnection.java:263)
      at org.jboss.resource.adapter.jdbc.local.LocalManagedConnectionFactory.matchManagedConnections(LocalManagedConnectionFactory.java:183)
      at org.jboss.resource.connectionmanager.InternalManagedConnectionPool.getConnection(InternalManagedConnectionPool.java:166)
      at org.jboss.resource.connectionmanager.JBossManagedConnectionPool$BasePool.getConnection(JBossManagedConnectionPool.java:534)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.getManagedConnection(BaseConnectionManager2.java:395)
      at org.jboss.resource.connectionmanager.TxConnectionManager.getManagedConnection(TxConnectionManager.java:297)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2.allocateConnection(BaseConnectionManager2.java:447)
      at org.jboss.resource.connectionmanager.BaseConnectionManager2$ConnectionManagerProxy.allocateConnection(BaseConnectionManager2.java:874)
      at org.jboss.resource.adapter.jdbc.WrapperDataSource.getConnection(WrapperDataSource.java:103)
      at org.hibernate.connection.DatasourceConnectionProvider.getConnection(DatasourceConnectionProvider.java:59)
      at org.hibernate.jdbc.AbstractBatcher.openConnection(AbstractBatcher.java:424)
      at org.hibernate.jdbc.JDBCContext.connect(JDBCContext.java:162)
      at org.hibernate.jdbc.JDBCContext.connection(JDBCContext.java:97)
      at org.hibernate.jdbc.AbstractBatcher.prepareQueryStatement(AbstractBatcher.java:86)
      [.......]

              jimm_jira jimm (Inactive)
              jimm_jira jimm (Inactive)
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

                Created:
                Updated:
                Resolved: