We have a mixed JDK environment on our internal Windows Server. Tomcat is installed using the service installer and its service configuration points to the JDK 17 as it serves some internal apps requiring JDK 12+.
JAVA_HOME points to older JDK 8. PATH variable contains link to JDK 8, but also to JDK 11 in this order (the latter link is a bug I spotted right now). And now weirdness comes. From time to time the tomcat somehow switches to older JDK: we detect this by the fact the internal webapp complains about the issue only present in pre-JDK 12 versions. I assume JDK 11 is used as this is related to JDK HttpClient which is not the part of the JDK 8. It is strange the only reference to JDK 11 is that PATH entry, but is the second one so JDK 8 should win if the PATH is somehow involved. Actual case: the tomcat was restarted manually on Friday using tray icon and in the log I can see that JDK 17 was picked up. There was no user activity during the weekend. Today when accessing the app error is raised. Manual restart via try icon fixed the issue. This issue is not urgent in any case, there are no mission-critical apps running on our server. But I am quite surprised by this behavior. Kind of the race condition, which could be dangerous. Regards, Jan