After copying/cloning a JIRA WAR instance, JIRA keeps connecting to the wrong database
Symptoms
After copying/cloning a JIRA WAR instance, JIRA keeps connecting to the wrong database even thought jira.xml files is pointing to the correct database.. Notice that if you fill jira.xml file with an invalid DNS name for the database server, it will throw errors in the atlassian-jira.log file saying that it can't connect to the database. Altought, if you put the new database server name back in again, it starts connecting to the old database again (from the cloned instance).
Cause
JIRA only considers the full configuration after deleting the 'JIRA' directory (this will be called JIRA as per stated in this documentation, but while following the WAR installation document, you can choose any name you want) located at the webapps in the tomcat directory.
Resolution
- Make sure the instance is down;
- Make sure you have a backup of the 'JIRA' directory;
This 'JIRA' directory will actually have the name you used in the configuration of the XML file stated in this point of the WAR documentation, so if you name it my_dir.xml, the name of the directory will also be 'my_dir'. We will call it 'JIRA' directory in this resolution as stated in the documentation for reference.
- Delete the 'JIRA' directory;
- Start JIRA again;
- Reindex JIRA;
This should be recreated when JIRA is started.