Bitbucket Server service (64-bit) fails to start - not a valid Win32 application
Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.
Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.
*Except Fisheye and Crucible
Problem
After upgrading Bitbucket Server or updating the JVM, the Bitbucket Server service will no longer start. Trying to run "NET START BITBUCKET" gives the following:
1
2
3
The Atlassian Bitbucket Server service could not be started.
A service specific error occured: 1.
The System event log has the following message:
1
The Atlassian Bitbucket Server service terminated with service-specific error Incorrect function.
The following appears in the log: <Bitbucket Server install directory>/logs/commons-daemon.YYYY-MM-DD.log
1
2
3
4
5
6
7
8
9
10
[2013-02-19 20:51:42] [info] Commons Daemon procrun (1.0.10.0 64-bit) started
[2013-02-19 20:51:42] [info] Running 'bitbucket' Service...
[2013-02-19 20:51:42] [info] Starting service...
[2013-02-19 20:51:42] [error] %1 is not a valid Win32 application.
[2013-02-19 20:51:42] [error] Failed creating java C:\devTools\Java\x32\jdk1.6.0_33\jre\bin\server\jvm.dll
[2013-02-19 20:51:42] [error] %1 is not a valid Win32 application.
[2013-02-19 20:51:42] [error] ServiceStart returned 1
[2013-02-19 20:51:42] [error] %1 is not a valid Win32 application.
[2013-02-19 20:51:42] [info] Run service finished.
[2013-02-19 20:51:42] [info] Commons Daemon procrun finished
However, Bitbucket Server will be up and running if you run it directly, as in executing the start-bitbucket.bat file. Tomcat comes up running and everything will work.
Cause
You have a 64-bit OS and you skipped the custom changes that have to be done to your new installation.
There is a mismatch between the Java JVM (32-bit) and the Bitbucket Server binary (64-bit).
Resolution
1. Skipped custom changes
If you are using a 64-bit version of Windows, first ensure that Bitbucket Server uses a 64-bit JVM (check by running java -version
in a Command Prompt, and ensure that the JAVA_HOME
system environment variable points to the 64-bit JVM), and then replace the 32-bit Tomcat binaries with their 64-bit counterparts in the <Bitbucket Server installation directory>/bin
directory:
1
2
3
4
5
cd <BSERV-INST/bin>
rename tomcat7.exe tomcat7.exe.x86
rename tcnative-1.dll tcnative-1.dll.x86
rename tomcat7.exe.x64 tomcat7.exe
rename tcnative-1.dll.x64 tcnative-1.dll
2. JVM mismatch
Remove the existing service, e.g.
<Bitbucket Server install directory>/bin/service remove
Install a 64-bit Java JDK.
Open a shell window and ensure
JAVA_HOME
points to the root install folder of the Java version, e.g.C:\devTools\Java\x64\jdk1.7.0_10
Install the service, e.g.
<Bitbucket Server install directory>/bin/service install
The value of JAVA_HOME
is set upon service creation (either via the system or local variable). Changing the value of the system variable after the service has been installed will have no affect on the service.
3. Your Windows service is pointing to the incorrect JVM
Sometimes you could be
Service Name
If you don't know the exact name of your old Stash service, you can find out what they are by following the steps below:
Navigate to 'Control Panel' > 'Administrative Tools' > 'Services'.
The 'Services' window should appear.
Right-click on the service you wish to find out the name of, and select 'Properties' from the popup menu.
The 'Service name' should appear in the 'General' tab.
Use this parameter as a substitute for
<ServiceName here>
on the command below.
Open the command window from
Start >> Run >> type in 'cmd' >> Enter
cd
to thebin
directory the Stash Installation (<Bitbucket Installation dir>/bin
).Run from there:
Bitbucket 4.x and older
1
tomcat8w //ES//<ServiceName here>
Bitbucket 5.x and newer
1
bservmgr.exe //ES/<ServiceName here>
A window will pop up. Click on the Java tab. On the field "Java Virtual Machine" check the value that is input.
It will be
%JAVA_HOME%\bin\server\jvm.dll
. For example, there was a situation that the customer had:C:\program files\java\jre1.8.0_45\bin\server\jvm.dll
But we pointed his service to a different JRE: C:\Program Files\Java\jre1.8.0_60\bin\server\jvm.dll
Make sure the account used to start the service has access to the jvm.dll otherwise, there will be an error message to start Bitbucket Service as following:
1
2
3
[2020-10-13 13:57:43] [info] [ 6896] Starting service...
[2020-10-13 13:57:43] [error] [ 6896] Failed creating java c:\program files\atlassian\jira\jre\bin\server\jvm.dll
[2020-10-13 13:57:43] [error] [ 6896] Access is denied.
Was this helpful?