HTTP Status 500 - Could not determine database type. Communications link failure

Dušan Plavák June 10, 2015

Hi there, my JIRA is running but I can not access it from web because of error.

I have JIRA and DB on same machine, I am running it on linux and using MySQL DB and I can connect from command line with same username and pass to the specified DB

I also tried change localhost to 127.0.0.1 in dbconfig.xml - it does not work...

 

Well all was working but suddenly it stops and I do not know why...

I use JIRA with APACHE and it is secured by SSL...

 

Any help would be appreciated

 

HTTP Status 500 - Could not determine database type. (Communications link failure
type Exception report
message Could not determine database type. (Communications link failure
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.ofbiz.core.util.GeneralRuntimeException: Could not determine database type. (Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.)
	org.ofbiz.core.entity.config.DatasourceInfo.getDatabaseTypeFromJDBCConnection(DatasourceInfo.java:409)
	org.ofbiz.core.entity.GenericDAO.selectListIteratorByCondition(GenericDAO.java:840)
	org.ofbiz.core.entity.GenericDAO.selectByAnd(GenericDAO.java:739)
	org.ofbiz.core.entity.GenericHelperDAO.findByAnd(GenericHelperDAO.java:150)
	org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:901)
	org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:879)
	org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:848)
	com.opensymphony.module.propertyset.ofbiz.OFBizPropertySet.findPropertyEntry(OFBizPropertySet.java:298)
	com.opensymphony.module.propertyset.ofbiz.OFBizPropertySet.exists(OFBizPropertySet.java:170)
	com.atlassian.jira.propertyset.JiraCachingPropertySet.exists(JiraCachingPropertySet.java:744)
	com.atlassian.jira.propertyset.BootstrapOfBizPropertyEntryStore.getEntry(BootstrapOfBizPropertyEntryStore.java:60)
	com.atlassian.jira.propertyset.CachingOfBizPropertySet.get(CachingOfBizPropertySet.java:196)
	com.opensymphony.module.propertyset.AbstractPropertySet.getString(AbstractPropertySet.java:305)
	com.atlassian.jira.config.properties.ApplicationPropertiesStore.getStringFromDb(ApplicationPropertiesStore.java:272)
	com.atlassian.jira.config.properties.ApplicationPropertiesImpl.getString(ApplicationPropertiesImpl.java:57)
	com.atlassian.jira.config.properties.ApplicationPropertiesImpl.getEncoding(ApplicationPropertiesImpl.java:138)
	com.atlassian.jira.config.properties.ApplicationPropertiesImpl.getContentType(ApplicationPropertiesImpl.java:162)
	com.atlassian.jira.web.filters.JiraEncodingFilter.getContentType(JiraEncodingFilter.java:59)
	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:39)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.jira.web.filters.PathMatchingEncodingFilter.doFilter(PathMatchingEncodingFilter.java:49)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.jira.startup.JiraStartupChecklistFilter.doFilter(JiraStartupChecklistFilter.java:79)
	com.atlassian.jira.web.filters.MultipartBoundaryCheckFilter.doFilter(MultipartBoundaryCheckFilter.java:41)
	com.atlassian.jira.web.filters.steps.ChainedFilterStepRunner.doFilter(ChainedFilterStepRunner.java:87)
	com.atlassian.jira.web.filters.JiraFirstFilter.doFilter(JiraFirstFilter.java:61)
	com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:121)
	com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:92)
	com.atlassian.jira.web.filters.gzip.JiraGzipFilter.doFilter(JiraGzipFilter.java:56)

root cause
com.mysql.jdbc.exceptions.jdbc4.CommunicationsException: Communications link failure

The last packet sent successfully to the server was 0 milliseconds ago. The driver has not received any packets from the server.
	sun.reflect.GeneratedConstructorAccessor15.newInstance(Unknown Source)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
	com.mysql.jdbc.SQLError.createCommunicationsException(SQLError.java:1036)
	com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:338)
	com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2232)
	com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265)
	com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064)
	com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
	com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
	sun.reflect.GeneratedConstructorAccessor12.newInstance(Unknown Source)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
	com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395)
	com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
	java.sql.DriverManager.getConnection(DriverManager.java:664)
	java.sql.DriverManager.getConnection(DriverManager.java:247)
	org.ofbiz.core.entity.ConnectionFactory.tryGenericConnectionSources(ConnectionFactory.java:87)
	org.ofbiz.core.entity.transaction.JNDIFactory.getConnection(JNDIFactory.java:146)
	org.ofbiz.core.entity.TransactionFactory.getConnection(TransactionFactory.java:136)
	org.ofbiz.core.entity.ConnectionFactory.getConnection(ConnectionFactory.java:59)
	org.ofbiz.core.entity.config.DatasourceInfo.getDatabaseTypeFromJDBCConnection(DatasourceInfo.java:402)
	org.ofbiz.core.entity.GenericDAO.selectListIteratorByCondition(GenericDAO.java:840)
	org.ofbiz.core.entity.GenericDAO.selectByAnd(GenericDAO.java:739)
	org.ofbiz.core.entity.GenericHelperDAO.findByAnd(GenericHelperDAO.java:150)
	org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:901)
	org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:879)
	org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:848)
	com.opensymphony.module.propertyset.ofbiz.OFBizPropertySet.findPropertyEntry(OFBizPropertySet.java:298)
	com.opensymphony.module.propertyset.ofbiz.OFBizPropertySet.exists(OFBizPropertySet.java:170)
	com.atlassian.jira.propertyset.JiraCachingPropertySet.exists(JiraCachingPropertySet.java:744)
	com.atlassian.jira.propertyset.BootstrapOfBizPropertyEntryStore.getEntry(BootstrapOfBizPropertyEntryStore.java:60)
	com.atlassian.jira.propertyset.CachingOfBizPropertySet.get(CachingOfBizPropertySet.java:196)
	com.opensymphony.module.propertyset.AbstractPropertySet.getString(AbstractPropertySet.java:305)
	com.atlassian.jira.config.properties.ApplicationPropertiesStore.getStringFromDb(ApplicationPropertiesStore.java:272)
	com.atlassian.jira.config.properties.ApplicationPropertiesImpl.getString(ApplicationPropertiesImpl.java:57)
	com.atlassian.jira.config.properties.ApplicationPropertiesImpl.getEncoding(ApplicationPropertiesImpl.java:138)
	com.atlassian.jira.config.properties.ApplicationPropertiesImpl.getContentType(ApplicationPropertiesImpl.java:162)
	com.atlassian.jira.web.filters.JiraEncodingFilter.getContentType(JiraEncodingFilter.java:59)
	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:39)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.jira.web.filters.PathMatchingEncodingFilter.doFilter(PathMatchingEncodingFilter.java:49)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.jira.startup.JiraStartupChecklistFilter.doFilter(JiraStartupChecklistFilter.java:79)
	com.atlassian.jira.web.filters.MultipartBoundaryCheckFilter.doFilter(MultipartBoundaryCheckFilter.java:41)
	com.atlassian.jira.web.filters.steps.ChainedFilterStepRunner.doFilter(ChainedFilterStepRunner.java:87)
	com.atlassian.jira.web.filters.JiraFirstFilter.doFilter(JiraFirstFilter.java:61)
	com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:121)
	com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:92)
	com.atlassian.jira.web.filters.gzip.JiraGzipFilter.doFilter(JiraGzipFilter.java:56)

root cause
java.net.ConnectException: Connection refused
	java.net.PlainSocketImpl.socketConnect(Native Method)
	java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:345)
	java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:206)
	java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:188)
	java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
	java.net.Socket.connect(Socket.java:589)
	com.mysql.jdbc.StandardSocketFactory.connect(StandardSocketFactory.java:213)
	com.mysql.jdbc.MysqlIO.<init>(MysqlIO.java:297)
	com.mysql.jdbc.ConnectionImpl.coreConnect(ConnectionImpl.java:2232)
	com.mysql.jdbc.ConnectionImpl.connectOneTryOnly(ConnectionImpl.java:2265)
	com.mysql.jdbc.ConnectionImpl.createNewIO(ConnectionImpl.java:2064)
	com.mysql.jdbc.ConnectionImpl.<init>(ConnectionImpl.java:790)
	com.mysql.jdbc.JDBC4Connection.<init>(JDBC4Connection.java:44)
	sun.reflect.GeneratedConstructorAccessor12.newInstance(Unknown Source)
	sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	java.lang.reflect.Constructor.newInstance(Constructor.java:422)
	com.mysql.jdbc.Util.handleNewInstance(Util.java:377)
	com.mysql.jdbc.ConnectionImpl.getInstance(ConnectionImpl.java:395)
	com.mysql.jdbc.NonRegisteringDriver.connect(NonRegisteringDriver.java:325)
	java.sql.DriverManager.getConnection(DriverManager.java:664)
	java.sql.DriverManager.getConnection(DriverManager.java:247)
	org.ofbiz.core.entity.ConnectionFactory.tryGenericConnectionSources(ConnectionFactory.java:87)
	org.ofbiz.core.entity.transaction.JNDIFactory.getConnection(JNDIFactory.java:146)
	org.ofbiz.core.entity.TransactionFactory.getConnection(TransactionFactory.java:136)
	org.ofbiz.core.entity.ConnectionFactory.getConnection(ConnectionFactory.java:59)
	org.ofbiz.core.entity.config.DatasourceInfo.getDatabaseTypeFromJDBCConnection(DatasourceInfo.java:402)
	org.ofbiz.core.entity.GenericDAO.selectListIteratorByCondition(GenericDAO.java:840)
	org.ofbiz.core.entity.GenericDAO.selectByAnd(GenericDAO.java:739)
	org.ofbiz.core.entity.GenericHelperDAO.findByAnd(GenericHelperDAO.java:150)
	org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:901)
	org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:879)
	org.ofbiz.core.entity.GenericDelegator.findByAnd(GenericDelegator.java:848)
	com.opensymphony.module.propertyset.ofbiz.OFBizPropertySet.findPropertyEntry(OFBizPropertySet.java:298)
	com.opensymphony.module.propertyset.ofbiz.OFBizPropertySet.exists(OFBizPropertySet.java:170)
	com.atlassian.jira.propertyset.JiraCachingPropertySet.exists(JiraCachingPropertySet.java:744)
	com.atlassian.jira.propertyset.BootstrapOfBizPropertyEntryStore.getEntry(BootstrapOfBizPropertyEntryStore.java:60)
	com.atlassian.jira.propertyset.CachingOfBizPropertySet.get(CachingOfBizPropertySet.java:196)
	com.opensymphony.module.propertyset.AbstractPropertySet.getString(AbstractPropertySet.java:305)
	com.atlassian.jira.config.properties.ApplicationPropertiesStore.getStringFromDb(ApplicationPropertiesStore.java:272)
	com.atlassian.jira.config.properties.ApplicationPropertiesImpl.getString(ApplicationPropertiesImpl.java:57)
	com.atlassian.jira.config.properties.ApplicationPropertiesImpl.getEncoding(ApplicationPropertiesImpl.java:138)
	com.atlassian.jira.config.properties.ApplicationPropertiesImpl.getContentType(ApplicationPropertiesImpl.java:162)
	com.atlassian.jira.web.filters.JiraEncodingFilter.getContentType(JiraEncodingFilter.java:59)
	com.atlassian.core.filters.encoding.AbstractEncodingFilter.doFilter(AbstractEncodingFilter.java:39)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.jira.web.filters.PathMatchingEncodingFilter.doFilter(PathMatchingEncodingFilter.java:49)
	com.atlassian.core.filters.AbstractHttpFilter.doFilter(AbstractHttpFilter.java:31)
	com.atlassian.jira.startup.JiraStartupChecklistFilter.doFilter(JiraStartupChecklistFilter.java:79)
	com.atlassian.jira.web.filters.MultipartBoundaryCheckFilter.doFilter(MultipartBoundaryCheckFilter.java:41)
	com.atlassian.jira.web.filters.steps.ChainedFilterStepRunner.doFilter(ChainedFilterStepRunner.java:87)
	com.atlassian.jira.web.filters.JiraFirstFilter.doFilter(JiraFirstFilter.java:61)
	com.atlassian.gzipfilter.GzipFilter.doFilterInternal(GzipFilter.java:121)
	com.atlassian.gzipfilter.GzipFilter.doFilter(GzipFilter.java:92)
	com.atlassian.jira.web.filters.gzip.JiraGzipFilter.doFilter(JiraGzipFilter.java:56)

note The full stack trace of the root cause is available in the Apache Tomcat/7.0.55 logs.
Apache Tomcat/7.0.55

 

Apache config:

<VirtualHost *:80>
    ServerName jira_site
    ServerAdmin dusan.plavak@...
    ErrorLog ${APACHE_LOG_DIR}/jira_site.log
    CustomLog ${APACHE_LOG_DIR}/jira_siteacc.log combined
    Redirect permanent / https://jira_site/
</VirtualHost>
<VirtualHost *:443>
    ServerName jira_site
    ServerAdmin dusan.plavak@...
    ErrorLog ${APACHE_LOG_DIR}/jira_site.log
    CustomLog ${APACHE_LOG_DIR}/jira_siteacc.log combined
    SSLEngine on
    SSLProtocol all -SSLv2
    SSLCipherSuite ALL:!ADH:!EXPORT:!SSLv2:RC4+RSA:+HIGH:+MEDIUM
    SSLCertificateFile /etc/ssl/....crt
    SSLCertificateKeyFile /etc/ssl/....key
    SSLCertificateChainFile /etc/ssl/....pem
    SSLProxyEngine      On
    # JIRA Proxy Configuration:
    <Proxy *>
        Require all granted
    </Proxy>
    ProxyRequests           Off
    ProxyPreserveHost       On
    ProxyPass               /       http://localhost:8020/
    ProxyPassReverse        /       http://localhost:8020/
</VirtualHost>

 

Also note, if I run from cmd 

mysql -u jirauser -p --host=localhost --port=3306

I am connected to mysql server without any problem... ( also "use jiradb;" works...)

Here it is:

<?xml version="1.0" encoding="UTF-8"?>
<jira-database-config>
  <name>defaultDS</name>
  <delegator-name>default</delegator-name>
  <database-type>mysql</database-type>
  <jdbc-datasource>
    <url>jdbc:mysql://localhost:3306/jiradb?useUnicode=true&characterEncoding=UTF8&sessionVariables=storage_engine=InnoDB</url>
    <driver-class>com.mysql.jdbc.Driver</driver-class>
    <username>jirauser</username>
    <password>************</password>
    <pool-min-size>20</pool-min-size>
    <pool-max-size>20</pool-max-size>
    <pool-max-wait>30000</pool-max-wait>
    <validation-query>select 1</validation-query>
    <min-evictable-idle-time-millis>60000</min-evictable-idle-time-millis>
    <time-between-eviction-runs-millis>300000</time-between-eviction-runs-millis>
    <pool-max-idle>20</pool-max-idle>
    <pool-remove-abandoned>true</pool-remove-abandoned>
    <pool-remove-abandoned-timeout>300</pool-remove-abandoned-timeout>
    <pool-test-while-idle>true</pool-test-while-idle>
    <validation-query-timeout>5</validation-query-timeout>
  </jdbc-datasource>
</jira-database-config>

1 answer

0 votes
Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2015

The connection to the database is failing - you've either given JIRA the wrong connection string or credentials, or your host setup is blocking the link in some way.  Apache is irrelevant at this point, the problem is JIRA and the database, you need to debug that.

Could you post the mysql connection setup you are using for the command line and where you configured it in JIRA?

Dušan Plavák June 10, 2015

Thanks, I updated question with dbconfig.xml

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 10, 2015

Ok, that's a good test. What does the mysql server logs say about the refused connections? Also, do you have selinux enabled? Try setting it to permissive and try again.

Dušan Plavák June 11, 2015

Hi there, i found where the problem is, but i do not know the correct solution for this right now. The problem is with my configuration of mysql where I have this setting in my.cnf # # Instead of skip-networking the default is now to listen only on # localhost which is more compatible and is not less secure. bind-address = 172.31.37.15 The bind address is set to local ip address of server so other nodes in local network could connect to it... I see one solution to make user jirauser@172.31.37.15 on mysql and in jira dbconfig.xml use instead of localhost that ip address but it is correct solution? Thanks

Nic Brough -Adaptavist-
Community Leader
Community Leader
Community Leaders are connectors, ambassadors, and mentors. On the online community, they serve as thought leaders, product experts, and moderators.
June 11, 2015

That would be it - JIRA is passing in a user that MySQL hasn't been set up to accept. I think your solution is a good one because it's totally locked down.

Suggest an answer

Log in or Sign up to answer