Skip to main content
Skip table of contents

Database datasource - AbstractMethodError when configuring a SQL Server datasource

Symptoms

You are trying to configure a SQL Server datasource, the connection fails and you find the following error in the logs :

CODE
2017-01-17 14:30:51,385 http-nio-8080-exec-24 WARN jira_admin 870x237x1 1nlci90 10.184.198.35,10.160.7.4 /nfeed/admin/models/datasources/test [c.v.j.p.s.s.r.execution.datasource.DatasourceService] Error while testing connection:
java.lang.AbstractMethodError
	at net.sourceforge.jtds.jdbc.JtdsConnection.isValid(JtdsConnection.java:2833)
	at org.apache.tomcat.dbcp.dbcp2.DelegatingConnection.isValid(DelegatingConnection.java:916)
	at org.apache.tomcat.dbcp.dbcp2.PoolableConnection.validate(PoolableConnection.java:282)
	at org.apache.tomcat.dbcp.dbcp2.PoolableConnectionFactory.validateConnection(PoolableConnectionFactory.java:357)
	at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.validateConnectionFactory(BasicDataSource.java:2307)
	at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createPoolableConnectionFactory(BasicDataSource.java:2290)
	at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.createDataSource(BasicDataSource.java:2038)
	at org.apache.tomcat.dbcp.dbcp2.BasicDataSource.getConnection(BasicDataSource.java:1532)

Cause

This error occurs because of a version incompatibility between a Tomcat library (DBCP) and the JTDS driver. The latest JTDS driver works just fine with Tomcat 7, not with Tomcat 8.


Resolution

The workaround is simple. You need to add a validationQuery property to your resource definition like this :

CODE
validationQuery="select 1"

The resource definition is located in your server.xml or in JIRA context.xml file. This should look like this :

Example of resource definition
XML
<Resource name="jdbc/ext2" auth="Container" type="javax.sql.DataSource"
      Username="xxxxx"
      Password="xxxxxx"
      driverClassName="net.sourceforge.jtds.jdbc.Driver"
      validationQuery="select 1"
      url="jdbc:jtds:Sqlserver://JIRAXXXXXXXX;user=xxxxx;password=xxxxx"
   /> 
JavaScript errors detected

Please note, these errors can depend on your browser setup.

If this problem persists, please contact our support.