Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot start Confluence service because it claims I don't have JDK

Khiem Ngo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 5, 2020

I recently installed a new Confluence installation on a clean Windows Server 2019 server. Confluence starts fine when I run start-confluence.bat from an admin command prompt, but it runs in the foreground. When Confluence installed, it created a service, but I cannot get that service to start, nor can I find any logs to give me direction on what went wrong. The only error I get when attempting to start the service is:

Windows could not start the Confluence<numbers> on Local Computer. For more information, review the system event log. If this is a non-Microsoft service, contact the service vendor, and refer to service-specific error code 1.

The system event log has this error:

The Confluence<numbers> service terminated with the following service-specific error:
Incorrect function.

 

I tried to remove and reinstall the service, but when I attempt to either install or remove the service using the service.bat, I get the error:

The JAVA_HOME environment variable is not defined correctly
This environment variable is needed to run this program
NB: JAVA_HOME should point to a JDK not a JRE

I have made sure that JAVA_HOME points to the copy of OpenJDK that is included in the Confluence program directory, and even tried repointing it to a copy of that same folder at c:\jre to try to eliminate the potential issue for folder paths with spaces that I found could be a potential issue.

 

Overall, this is felling like a permissions issue, but the network service appears to have full control over the entire Confluence folder, so I don't know what's missing.

3 answers

1 accepted

0 votes
Answer accepted
Khiem Ngo
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
May 5, 2020

It appears the solution was despite Confluence coming with its own copy of OpenJDK and it running perfectly fine when starting it as an administrative user, I had to install the AdoptOpenJDK separately, then add JAVA_HOME and JRE_HOME environmental variables. I was then able to remove and re-add the service and it worked. That was an utterly nonsensical solution, but it works, so whatever...

Robert Battam November 7, 2023

Check the batch file that you launch th service with, as sometimes you might find someone has set it to redeclare variables upon launch, and this will override any config file settings or environmetn variables for those same settings.  I had that problem once.   You can either remove them or change them to what you need.

0 votes
salvijus January 23, 2024

Hi,

I had this problem after JSM update on a server with Linux SE enabled and find out that in my case it was related to lack of executable permissions on /opt/atlassian/jira/jre/bin/java and folders inside /opt/atlassian/jira. 

Maybe your case is similar...

0 votes
Mike Rathwell
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
May 5, 2020

Hi @Khiem Ngo 

I haven't run Atlassian stuff on Windows in a long time for... reasons... However, thinking back, I recall there were some things that needed to be done to get it working.

I don't think it's a permission issue. Rather it feels like the service isn't seeing your JAVA_HOME variable set at the system level. A quick grep of Google suggests this is a rather surprising thing. To test it, you might toss a "echo $JAVA_HOME" in the startup scripts to see what the service is seeing.

Also, do have a look at this very good page on setting up Confluence as a Windows service. There are a lot of tips/tricks to making it go there.

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events