Ignition fails to start after reboot

I've searched the forums and was unable to find anything with the exact issue I'm having. I created a new EC2 Windows instance and installed Ignition 8.1.23. I did not install Java separately. The gateway runs fine until a reboot, then the Ignition service would not start. This was found in the log:

WARN   | wrapper  | 2023/02/01 19:37:28 | The 'JAVA_HOME' environment variable was referenced but has not been defined.
STATUS | wrapper  | 2023/02/01 19:37:28 | --> Wrapper Started as Service
STATUS | wrapper  | 2023/02/01 19:37:29 | Java Service Wrapper Standard Edition 64-bit 3.5.42
STATUS | wrapper  | 2023/02/01 19:37:29 |   Copyright (C) 1999-2020 Tanuki Software, Ltd. All Rights Reserved.
STATUS | wrapper  | 2023/02/01 19:37:29 |     http://wrapper.tanukisoftware.com
STATUS | wrapper  | 2023/02/01 19:37:29 |   Licensed to Inductive Automation for Inductive Automation
STATUS | wrapper  | 2023/02/01 19:37:29 | 
FATAL  | wrapper  | 2023/02/01 19:37:29 | Unable to execute Java command.  The system cannot find the file specified. (0x2)
FATAL  | wrapper  | 2023/02/01 19:37:29 |     "%JAVA_HOME%\bin\java" -version
ADVICE | wrapper  | 2023/02/01 19:37:29 | 
ADVICE | wrapper  | 2023/02/01 19:37:29 | --------------------------------------------------------------------
ADVICE | wrapper  | 2023/02/01 19:37:29 | Advice:
ADVICE | wrapper  | 2023/02/01 19:37:29 | Usually when the Wrapper fails to start the JVM process, it is
ADVICE | wrapper  | 2023/02/01 19:37:29 | because of a problem with the value of the configured Java command.
ADVICE | wrapper  | 2023/02/01 19:37:29 | Currently:
ADVICE | wrapper  | 2023/02/01 19:37:29 | wrapper.java.command=%JAVA_HOME%/bin/java
ADVICE | wrapper  | 2023/02/01 19:37:29 | Please make sure that the PATH or any other referenced environment
ADVICE | wrapper  | 2023/02/01 19:37:29 | variables are correctly defined for the current environment.
ADVICE | wrapper  | 2023/02/01 19:37:29 | --------------------------------------------------------------------

I opened ignition.conf and found that wrapper.java.command was referencing %JAVA_HOME% which could not be found. I changed the path to the following and the gateway launched:

wrapper.java.command=C:\Program Files\Inductive Automation\Ignition\lib\runtime\jre-win\bin\java.exe

I will probably set the environmental variables instead of hardcoding the path as a permanent solution but I wanted to check if anyone else has seen this issue before and hopefully if anyone encounters it in the future they will see the post and be able to resolve.

Did you use the standard windows installer? I checked my ignition.conf (8.1.24) and by default it has JAVA_HOME set before it's referenced.

#********************************************************************
# Wrapper Java Properties
#********************************************************************
# Java Application
#  Locate the java binary on the system PATH:
#  Specify a specific java binary:
set.JAVA_HOME=lib/runtime/jre-win
wrapper.java.command=%JAVA_HOME%/bin/java

I used the standard Windows installer. I restored a gateway backup so maybe that's why I'm missing this line:

set.JAVA_HOME=lib/runtime/jre-win

That was going to be my next question. Do you happen to know what version the backup was from?

Regardless, adding set.JAVA_HOME=lib/runtime/jre-win should prevent it from happening again. Or setting it in the environment variables of the OS directly like you mentioned.

Backup was from 7.9.19. Glad to hear I'm on the right track, hopefully this post helps others.

That makes sense then. Since there was no embedded JRE in 7.9, it was expected Java would be installed separately and the JAVA_HOME would already be set to point to your Java installation.

In 8.0+ with an embedded JRE the ignition.conf can set the JAVA_HOME path to point to the location in the install directory.

It would super nifty if the gateway restore would detect that and prevent overwrites but I'm sure the to-do list is long enough already and this is entirely preventable.

The ignition.conf from a backup is supposed to overwrite the existing one. And even for that JAVA_HOME setting, that's a valid thing to change from the default in 8.1 because you're allowed to specify your own JDK to use instead of the one we provide.

Thanks for clarifying Kevin. Any idea why the gateway would work just fine after the restore until the reboot?

I don't think a restore terminates the process, so you were probably just coasting along on the original JDK until you finally restarted it. If not that, then I'm not sure.