Starting Confluence service
Asked by Michel saliba:

Hi All,

I have intalled confluence atlassian-confluence-8.7.1-x64 on my personal laptop, the management interface was opening normally and a space has been created.(<http://localhost:8090/>)

I am trying to lunch confluence again after restarting my laptop but not able to access it   

C:\\Program Files\\Atlassian\\Confluence\\bin\>start-confluence

To run Confluence in the foreground, start the server with start-confluence.bat /fg  
"If you encounter issues starting up Confluence, please see the Installation guide at <http://confluence.atlassian.com/display/DOC/Confluence+Installation+Guide>"  
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined  
At least one of these environment variable is needed to run this program  
Neither the JAVA_HOME nor the JRE_HOME environment variable is defined  
At least one of these environment variable is needed to run this program  

Please advise


Answers:
author: Michel saliba
body: Hello Craig,  

I find the below error in catalina log  

11-Dec-2023 22:56:03.963 SEVERE \[main\] org.apache.catalina.util.LifecycleBase.handleSubClassException Failed to initialize component \[Connector\["http-nio-8090"\]\]  
org.apache.catalina.LifecycleException: Protocol handler initialization failed  
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1011)  
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)  
at org.apache.catalina.core.StandardService.initInternal(StandardService.java:554)  
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)  
at org.apache.catalina.core.StandardServer.initInternal(StandardServer.java:1039)  
at org.apache.catalina.util.LifecycleBase.init(LifecycleBase.java:127)  
at org.apache.catalina.startup.Catalina.load(Catalina.java:724)  
at org.apache.catalina.startup.Catalina.load(Catalina.java:746)  
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)  
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)  
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)  
at java.base/java.lang.reflect.Method.invoke(Unknown Source)  
at org.apache.catalina.startup.Bootstrap.load(Bootstrap.java:307)  
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:477)  
Caused by: java.net.BindException: Address already in use: bind  
at java.base/sun.nio.ch.Net.bind0(Native Method)  
at java.base/sun.nio.ch.Net.bind(Unknown Source)  
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(Unknown Source)  
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(Unknown Source)  
at org.apache.tomcat.util.net.NioEndpoint.initServerSocket(NioEndpoint.java:276)  
at org.apache.tomcat.util.net.NioEndpoint.bind(NioEndpoint.java:231)  
at org.apache.tomcat.util.net.AbstractEndpoint.bindWithCleanup(AbstractEndpoint.java:1326)  
at org.apache.tomcat.util.net.AbstractEndpoint.init(AbstractEndpoint.java:1339)  
at org.apache.coyote.AbstractProtocol.init(AbstractProtocol.java:654)  
at org.apache.coyote.http11.AbstractHttp11Protocol.init(AbstractHttp11Protocol.java:75)  
at org.apache.catalina.connector.Connector.initInternal(Connector.java:1009)  
... 13 more  

<br />

But also I have tried to restart my laptop then starting the service (start-confluence) to confirm that this is the first binding and also it fails.


author: Michel saliba
body: Hello Craig,  

yes I have adjusted setenv under C:\\Program Files\\Atlassian\\Confluence\\bin to include   
SET "JAVA_HOME=C:\\Program Files\\Atlassian\\Confluence\\jre"  

like the below :

<br />

SET "JAVA_HOME=C:\\Program Files\\Atlassian\\Confluence\\jre"  
:: IMPORTANT NOTE: Only set JAVA_HOME or JRE_HOME above this line  

i have started the service but it seems it is hanging when runing start-confluence  

2023-12-11 22:31:44,296 INFO \[Catalina-utility-1\] \[com.atlassian.confluence.lifecycle\] contextInitialized Using JVM argument -Dignore.endorsed.dirs=  
2023-12-11 22:31:44,297 INFO \[Catalina-utility-1\] \[com.atlassian.confluence.lifecycle\] contextInitialized Using JVM argument -Dcatalina.base=C:\\\\Program Files\\\\Atlassian\\\\Confluence  
2023-12-11 22:31:44,297 INFO \[Catalina-utility-1\] \[com.atlassian.confluence.lifecycle\] contextInitialized Using JVM argument -Dcatalina.home=C:\\\\Program Files\\\\Atlassian\\\\Confluence  
2023-12-11 22:31:44,297 INFO \[Catalina-utility-1\] \[com.atlassian.confluence.lifecycle\] contextInitialized Using JVM argument -Djava.io.tmpdir=C:\\\\Program Files\\\\Atlassian\\\\Confluence\\\\temp  
WARNING: sun.reflect.Reflection.getCallerClass is not supported. This will impact performance.  

Please advise

comments: author: Craig Nodwell
body: Do you have more to the log file? Like the actual error message maybe??


author: Michel saliba
body: Hello Craig  

I have stopped the service again using stop-confluence ,confirm that no service running on port 8090 , I have started it again without find any errors but it is still hanging   

11-Dec-2023 23:04:52.351 INFO \[main\] org.apache.catalina.core.StandardService.startInternal Starting service \[Tomcat-Standalone\]  
11-Dec-2023 23:04:52.351 INFO \[main\] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet engine: \[Apache Tomcat/9.0.82\]  
11-Dec-2023 23:04:54.114 INFO \[Catalina-utility-2\] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.  
11-Dec-2023 23:04:54.423 INFO \[Catalina-utility-2\] org.apache.catalina.core.ApplicationContext.log 1 Spring WebApplicationInitializers detected on classpath  
11-Dec-2023 23:04:54.668 INFO \[Catalina-utility-2\] org.apache.catalina.core.ApplicationContext.log Initializing Spring DispatcherServlet 'dispatcher'


author: Craig Nodwell
body: Hi [@Michel saliba](/t5/user/viewprofilepage/user-id/5382751) you need to set the path to both JAVA_HOME and JRE_HOME on the laptop prior to running the start-confluence.bat file this file is looking for these to be set.   

Here's a [page](https://learn.jamf.com/bundle/technical-articles/page/Configuring_JAVA_HOME_and_JRE_HOME_Environment_Variables_on_a_Windows_Server.html#:~:text=In%20the%20System%20Properties%20window,%5CJava%5Cjdk) for your review on how to do that.


Tags: confluence-server

server