Stash as a service and the database as currently configured is not accessible error
症状
If Stash is configured as a service on Windows, the following appears on the UI when it is started by the service:
A fatal error has occurred
The following problem occurred which prevents Atlassian Stash from starting correctly:
The database, as currently configured, is not accessible. Stash is configured to use the mysql driver (com.mysql.jdbc.Driver) but it is not available. Please follow the instructions to install the driver as per Connecting Stash to MySQL.
However, when starting Stash manually from its binary works just fine.
原因
You followed our Connecting Stash to MySQL document properly in regards to the step below:
Connecting Stash to MySQL
3. Copy the mysql-connector-java-5.1.XX-bin.jar file from the extracted directory to your <Stash home directory>/lib
(for Stash 2.1 or later).
However, <Stash home directory>/lib
support is a nicety added by our setenv scripts, which aren't called when running as a service. The service stuff is all baked into the tomcat?.exe
binary. That's why the driver when placed under <Stash home directory>/lib
only works when manually starting Stash.
ソリューション
As a workaround, place the MySQL jar connector (mysql-connector-java-5.1.x-bin.jar)
under <STASH_INSTALLATION_DIR>/atlassian-stash/WEB_INF/lib
instead if you are starting Stash as a service.
This is not given as a primary guideline on Connecting Stash to MySQL because the driver would be lost when upgrading Stash. Hence, if you upgrade Stash at this stage you will need to perform this again.
The final fix will be ready when STASH-3163 - Getting issue details... STATUS is resolved. Please add yourself as a watcher to this issue. We apologise for the inconvenience caused for the time being.